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

Method PrepareNames

Source/CPack/cmCPackGenerator.cxx:60–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60int cmCPackGenerator::PrepareNames()
61{
62 cmCPackLogger(cmCPackLog::LOG_DEBUG, "Create temp directory." << std::endl);
63
64 // checks CPACK_SET_DESTDIR support
65 if (this->IsOn("CPACK_SET_DESTDIR")) {
66 if (SETDESTDIR_UNSUPPORTED == this->SupportsSetDestdir()) {
67 cmCPackLogger(cmCPackLog::LOG_ERROR,
68 "CPACK_SET_DESTDIR is set to ON but the '"
69 << this->Name << "' generator does NOT support it."
70 << std::endl);
71 return 0;
72 }
73 if (SETDESTDIR_SHOULD_NOT_BE_USED == this->SupportsSetDestdir()) {
74 cmCPackLogger(cmCPackLog::LOG_WARNING,
75 "CPACK_SET_DESTDIR is set to ON but it is "
76 << "usually a bad idea to do that with '" << this->Name
77 << "' generator. Use at your own risk." << std::endl);
78 }
79 }
80
81 // Determine package-directory.
82 cmValue pkgDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
83 if (!pkgDirectory) {
84 cmCPackLogger(cmCPackLog::LOG_ERROR,
85 "CPACK_PACKAGE_DIRECTORY not specified" << std::endl);
86 return 0;
87 }
88 // Determine base-filename of the package.
89 cmValue pkgBaseFileName = this->GetOption("CPACK_PACKAGE_FILE_NAME");
90 if (!pkgBaseFileName) {
91 cmCPackLogger(cmCPackLog::LOG_ERROR,
92 "CPACK_PACKAGE_FILE_NAME not specified" << std::endl);
93 return 0;
94 }
95 // Determine filename of the package.
96 if (!this->GetOutputExtension()) {
97 cmCPackLogger(cmCPackLog::LOG_ERROR,
98 "No output extension specified" << std::endl);
99 return 0;
100 }
101 std::string pkgFileName =
102 cmStrCat(pkgBaseFileName, this->GetOutputExtension());
103 // Determine path to the package.
104 std::string pkgFilePath = cmStrCat(pkgDirectory, '/', pkgFileName);
105 // Determine top-level directory for packaging.
106 std::string topDirectory = cmStrCat(pkgDirectory, "/_CPack_Packages/");
107 {
108 cmValue toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
109 if (toplevelTag) {
110 topDirectory += cmStrCat(toplevelTag, '/');
111 }
112 }
113 topDirectory += *this->GetOption("CPACK_GENERATOR");
114 // Determine temporary packaging-directory.
115 std::string tmpDirectory = cmStrCat(topDirectory, '/', pkgBaseFileName);
116 // Determine path to temporary package file.
117 std::string tmpPkgFilePath = topDirectory + "/" + pkgFileName;

Callers 1

DoPackageMethod · 0.95

Calls 15

IsOnMethod · 0.95
SupportsSetDestdirMethod · 0.95
GetOptionMethod · 0.95
GetOutputExtensionMethod · 0.95
SetOptionIfNotSetMethod · 0.95
GetInstallPathMethod · 0.95
SetOptionMethod · 0.95
cmXMLSafeClass · 0.85
cmNonemptyFunction · 0.85
c_strMethod · 0.80
strMethod · 0.80
eraseMethod · 0.80

Tested by

no test coverage detected