| 58 | } |
| 59 | |
| 60 | int 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; |
no test coverage detected