mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 21:00:17 -06:00
Merge topic 'cpack-productbuild-identifier'
7213ceb869 CPack/productbuild: Add option to customize product identifier
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6738
This commit is contained in:
@@ -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
|
||||
|
||||
6
Help/release/dev/cpack-productbuild-identifier.rst
Normal file
6
Help/release/dev/cpack-productbuild-identifier.rst
Normal file
@@ -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.
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user