summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-03-21 15:42:46 +1100
committerCraig Scott <craig.scott@crascit.com>2022-03-21 15:43:46 +1100
commit2a8df7e7db2ecef9652ab27371c5dbfbc56b2617 (patch)
tree61ce8dce0797996233161e0abf79be3504ffc104
parent95eb8cbcfc0fc5ca4c784efa126b3aa3dafacefd (diff)
downloadcmake-2a8df7e7db2ecef9652ab27371c5dbfbc56b2617.tar.gz
productbuild: Don't write rootVolumeOnly attribute if writing domains
The rootVolumeOnly attribute is deprecated. Apple docs say to use domains instead. Fixes: #23343
-rw-r--r--Modules/Internal/CPack/CPack.distribution.dist.in3
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx16
2 files changed, 14 insertions, 5 deletions
diff --git a/Modules/Internal/CPack/CPack.distribution.dist.in b/Modules/Internal/CPack/CPack.distribution.dist.in
index e04f7bf9da..291b24d48f 100644
--- a/Modules/Internal/CPack/CPack.distribution.dist.in
+++ b/Modules/Internal/CPack/CPack.distribution.dist.in
@@ -4,6 +4,5 @@
<welcome file="@CPACK_RESOURCE_FILE_WELCOME_NOPATH@"/>
<readme file="@CPACK_RESOURCE_FILE_README_NOPATH@"/>
<license file="@CPACK_RESOURCE_FILE_LICENSE_NOPATH@"/>
- <options allow-external-scripts="no" customize="allow" rootVolumeOnly="false"></options>
- @CPACK_PACKAGEMAKER_CHOICES@
+@CPACK_APPLE_PKG_INSTALLER_CONTENT@
</installer-gui-script>
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index b2d8d9aa38..2a14ccffa5 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -120,10 +120,20 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile,
std::string distributionFile =
cmStrCat(metapackageFile, "/Contents/distribution.dist");
+ std::ostringstream xContents;
+ cmXMLWriter xout(xContents, 1);
+
+ // Installer-wide options
+ xout.StartElement("options");
+ xout.Attribute("allow-external-scripts", "no");
+ xout.Attribute("customize", "allow");
+ if (cmIsOff(this->GetOption("CPACK_PRODUCTBUILD_DOMAINS"))) {
+ xout.Attribute("rootVolumeOnly", "false");
+ }
+ xout.EndElement();
+
// Create the choice outline, which provides a tree-based view of
// the components in their groups.
- std::ostringstream choiceOut;
- cmXMLWriter xout(choiceOut, 1);
xout.StartElement("choices-outline");
// Emit the outline for the groups
@@ -169,7 +179,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile,
// Dark Aqua
this->CreateBackground("darkAqua", metapackageFile, genName, xout);
- this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str());
+ this->SetOption("CPACK_APPLE_PKG_INSTALLER_CONTENT", xContents.str());
// Create the distribution.dist file in the metapackage to turn it
// into a distribution package.