CPackProductBuild: Add options to sign packages

This commit is contained in:
Roman Wüger
2017-01-15 01:29:34 +01:00
committed by Brad King
parent 6286d26ca6
commit 48aad9cda0
3 changed files with 50 additions and 0 deletions

View File

@@ -75,6 +75,14 @@ int cmCPackProductBuildGenerator::PackageFiles()
std::string version = this->GetOption("CPACK_PACKAGE_VERSION");
std::string productbuild = this->GetOption("CPACK_COMMAND_PRODUCTBUILD");
std::string identityName;
if (const char* n = this->GetOption("CPACK_PRODUCTBUILD_IDENTITY_NAME")) {
identityName = n;
}
std::string keychainPath;
if (const char* p = this->GetOption("CPACK_PRODUCTBUILD_KEYCHAIN_PATH")) {
keychainPath = p;
}
pkgCmd << productbuild << " --distribution \"" << packageDirFileName
<< "/Contents/distribution.dist\""
@@ -82,6 +90,9 @@ int cmCPackProductBuildGenerator::PackageFiles()
<< "\""
<< " --resources \"" << resDir << "\""
<< " --version \"" << version << "\""
<< (identityName.empty() ? "" : " --sign \"" + identityName + "\"")
<< (keychainPath.empty() ? ""
: " --keychain \"" + keychainPath + "\"")
<< " \"" << packageFileNames[0] << "\"";
// Run ProductBuild
@@ -193,12 +204,23 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
std::string version = this->GetOption("CPACK_PACKAGE_VERSION");
std::string pkgbuild = this->GetOption("CPACK_COMMAND_PKGBUILD");
std::string identityName;
if (const char* n = this->GetOption("CPACK_PKGBUILD_IDENTITY_NAME")) {
identityName = n;
}
std::string keychainPath;
if (const char* p = this->GetOption("CPACK_PKGBUILD_KEYCHAIN_PATH")) {
keychainPath = p;
}
pkgCmd << pkgbuild << " --root \"" << packageDir << "\""
<< " --identifier \"" << pkgId << "\""
<< " --scripts \"" << scriptDir << "\""
<< " --version \"" << version << "\""
<< " --install-location \"/\""
<< (identityName.empty() ? "" : " --sign \"" + identityName + "\"")
<< (keychainPath.empty() ? ""
: " --keychain \"" + keychainPath + "\"")
<< " \"" << packageFile << "\"";
// Run ProductBuild