| 23 | cmCPackRPMGenerator::~cmCPackRPMGenerator() = default; |
| 24 | |
| 25 | int cmCPackRPMGenerator::InitializeInternal() |
| 26 | { |
| 27 | this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); |
| 28 | if (cmIsOff(this->GetOption("CPACK_SET_DESTDIR"))) { |
| 29 | this->SetOption("CPACK_SET_DESTDIR", "I_ON"); |
| 30 | } |
| 31 | /* Replace space in CPACK_PACKAGE_NAME in order to avoid |
| 32 | * rpmbuild scream on unwanted space in filename issue |
| 33 | * Moreover RPM file do not usually embed space in filename |
| 34 | */ |
| 35 | if (this->GetOption("CPACK_PACKAGE_NAME")) { |
| 36 | std::string packageName = this->GetOption("CPACK_PACKAGE_NAME"); |
| 37 | std::replace(packageName.begin(), packageName.end(), ' ', '-'); |
| 38 | this->SetOption("CPACK_PACKAGE_NAME", packageName); |
| 39 | } |
| 40 | /* same for CPACK_PACKAGE_FILE_NAME */ |
| 41 | if (this->GetOption("CPACK_PACKAGE_FILE_NAME")) { |
| 42 | std::string packageName = this->GetOption("CPACK_PACKAGE_FILE_NAME"); |
| 43 | std::replace(packageName.begin(), packageName.end(), ' ', '-'); |
| 44 | this->SetOption("CPACK_PACKAGE_FILE_NAME", packageName); |
| 45 | } |
| 46 | return this->Superclass::InitializeInternal(); |
| 47 | } |
| 48 | |
| 49 | void cmCPackRPMGenerator::AddGeneratedPackageNames() |
| 50 | { |