| 22 | cmCPackProductBuildGenerator::~cmCPackProductBuildGenerator() = default; |
| 23 | |
| 24 | int cmCPackProductBuildGenerator::PackageFiles() |
| 25 | { |
| 26 | // TODO: Use toplevel |
| 27 | // It is used! Is this an obsolete comment? |
| 28 | |
| 29 | std::string packageDirFileName = |
| 30 | this->GetOption("CPACK_TEMPORARY_DIRECTORY"); |
| 31 | |
| 32 | // Create the directory where component packages will be built. |
| 33 | std::string basePackageDir = |
| 34 | cmStrCat(packageDirFileName, "/Contents/Packages"); |
| 35 | if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str())) { |
| 36 | cmCPackLogger(cmCPackLog::LOG_ERROR, |
| 37 | "Problem creating component packages directory: " |
| 38 | << basePackageDir << std::endl); |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | if (!this->Components.empty()) { |
| 43 | std::map<std::string, cmCPackComponent>::iterator compIt; |
| 44 | for (compIt = this->Components.begin(); compIt != this->Components.end(); |
| 45 | ++compIt) { |
| 46 | std::string packageDir = cmStrCat(toplevel, '/', compIt->first); |
| 47 | if (!this->GenerateComponentPackage(basePackageDir, |
| 48 | GetPackageName(compIt->second), |
| 49 | packageDir, &compIt->second)) { |
| 50 | return 0; |
| 51 | } |
| 52 | } |
| 53 | } else { |
| 54 | if (!this->GenerateComponentPackage(basePackageDir, |
| 55 | this->GetOption("CPACK_PACKAGE_NAME"), |
| 56 | toplevel, nullptr)) { |
| 57 | return 0; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | std::string resDir = cmStrCat(packageDirFileName, "/Contents"); |
| 62 | |
| 63 | if (cmValue v = this->GetOptionIfSet("CPACK_PRODUCTBUILD_RESOURCES_DIR")) { |
| 64 | std::string userResDir = *v; |
| 65 | if (!cmSystemTools::CopyADirectory(userResDir, resDir)) { |
| 66 | cmCPackLogger(cmCPackLog::LOG_ERROR, |
| 67 | "Problem copying the resource files" << std::endl); |
| 68 | return 0; |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | // Copy or create all of the resource files we need. |
| 73 | if (!this->CopyCreateResourceFile("License", resDir) || |
| 74 | !this->CopyCreateResourceFile("ReadMe", resDir) || |
| 75 | !this->CopyCreateResourceFile("Welcome", resDir)) { |
| 76 | cmCPackLogger(cmCPackLog::LOG_ERROR, |
| 77 | "Problem copying the License, ReadMe and Welcome files" |
| 78 | << std::endl); |
| 79 | return 0; |
| 80 | } |
| 81 |
nothing calls this directly
no test coverage detected