diff options
-rw-r--r-- | Help/cpack_gen/productbuild.rst | 8 | ||||
-rw-r--r-- | Help/release/dev/cpack-productbuild-identifier.rst | 6 | ||||
-rw-r--r-- | Source/CPack/cmCPackPKGGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/CPack/cmCPackProductBuildGenerator.cxx | 14 |
4 files changed, 34 insertions, 5 deletions
diff --git a/Help/cpack_gen/productbuild.rst b/Help/cpack_gen/productbuild.rst index cf3041f..75d5cff 100644 --- a/Help/cpack_gen/productbuild.rst +++ b/Help/cpack_gen/productbuild.rst @@ -18,6 +18,14 @@ macOS using ProductBuild: the automatically detected command (or specify its location if the auto-detection fails to find it). +.. variable:: CPACK_PRODUCTBUILD_IDENTIFIER + + .. versionadded:: 3.23 + + Set the unique (non-localized) product identifier to be associated with the + product (i.e., ``com.kitware.cmake``). Any component product names will be + appended to this value. + .. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME .. versionadded:: 3.8 diff --git a/Help/release/dev/cpack-productbuild-identifier.rst b/Help/release/dev/cpack-productbuild-identifier.rst new file mode 100644 index 0000000..bfa0dd9 --- /dev/null +++ b/Help/release/dev/cpack-productbuild-identifier.rst @@ -0,0 +1,6 @@ +cpack-productbuild-identifier +----------------------------- + +* The :cpack_gen:`CPack productbuild Generator` gained a new variable, + :variable:`CPACK_PRODUCTBUILD_IDENTIFIER`, used to customize the unique + product identifier associated with the product. 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; |