MCPcopy Create free account
hub / github.com/Kitware/CMake / PackageFiles

Method PackageFiles

Source/CPack/cmCPackProductBuildGenerator.cxx:24–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22cmCPackProductBuildGenerator::~cmCPackProductBuildGenerator() = default;
23
24int 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

Callers

nothing calls this directly

Calls 10

c_strMethod · 0.80
GetOptionIfSetMethod · 0.80
strMethod · 0.80
cmStrCatFunction · 0.50
GetOptionMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected