diff options
author | Brad King <brad.king@kitware.com> | 2021-11-22 16:26:28 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-11-22 16:26:43 (GMT) |
commit | 86047f75fc70530b4e758ef52fa5ca095e5d2b66 (patch) | |
tree | 36d86804e50afa785aa4c8cdd138f7e7c3e3bdbe /Source | |
parent | 1cbb956b34b6418f200080180446d15e17a59e8b (diff) | |
parent | 7213ceb869bfe50acda93eaeab9f3d928f517cd8 (diff) | |
download | CMake-86047f75fc70530b4e758ef52fa5ca095e5d2b66.zip CMake-86047f75fc70530b4e758ef52fa5ca095e5d2b66.tar.gz CMake-86047f75fc70530b4e758ef52fa5ca095e5d2b66.tar.bz2 |
Merge topic 'cpack-productbuild-identifier'
7213ceb869 CPack/productbuild: Add option to customize product identifier
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6738
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackPKGGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/CPack/cmCPackProductBuildGenerator.cxx | 14 |
2 files changed, 20 insertions, 5 deletions
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 91adf32..b62fab8 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -210,9 +210,14 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group, void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout) { - std::string packageId = - cmStrCat("com.", this->GetOption("CPACK_PACKAGE_VENDOR"), '.', - this->GetOption("CPACK_PACKAGE_NAME"), '.', component.Name); + std::string packageId; + if (cmValue i = this->GetOption("CPACK_PRODUCTBUILD_IDENTIFIER")) { + packageId = cmStrCat(i, '.', component.Name); + } else { + packageId = + cmStrCat("com.", this->GetOption("CPACK_PACKAGE_VENDOR"), '.', + this->GetOption("CPACK_PACKAGE_NAME"), '.', component.Name); + } xout.StartElement("choice"); xout.Attribute("id", component.Name + "Choice"); diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index f55b8de..4ad616d 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -95,6 +95,10 @@ int cmCPackProductBuildGenerator::PackageFiles() if (cmValue p = this->GetOption("CPACK_PRODUCTBUILD_KEYCHAIN_PATH")) { keychainPath = p; } + std::string identifier; + if (cmValue i = this->GetOption("CPACK_PRODUCTBUILD_IDENTIFIER")) { + identifier = i; + } pkgCmd << productbuild << " --distribution \"" << packageDirFileName << "/Contents/distribution.dist\"" @@ -102,6 +106,7 @@ int cmCPackProductBuildGenerator::PackageFiles() << "\"" << " --resources \"" << resDir << "\"" << " --version \"" << version << "\"" + << (identifier.empty() ? "" : " --identifier \"" + identifier + "\"") << (identityName.empty() ? "" : " --sign \"" + identityName + "\"") << (keychainPath.empty() ? "" : " --keychain \"" + keychainPath + "\"") @@ -204,8 +209,13 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( // The command that will be used to run ProductBuild std::ostringstream pkgCmd; - std::string pkgId = cmStrCat("com.", this->GetOption("CPACK_PACKAGE_VENDOR"), - '.', this->GetOption("CPACK_PACKAGE_NAME")); + std::string pkgId; + if (cmValue n = this->GetOption("CPACK_PRODUCTBUILD_IDENTIFIER")) { + pkgId = n; + } else { + pkgId = cmStrCat("com.", this->GetOption("CPACK_PACKAGE_VENDOR"), '.', + this->GetOption("CPACK_PACKAGE_NAME")); + } if (component) { pkgId += '.'; pkgId += component->Name; |