summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-01-07 14:38:24 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-01-07 14:38:30 (GMT)
commit11b0ab167224d7bda2f7ccfacd026c322b4a1ca5 (patch)
tree77ae44a966ce851be5ae29ba6ea0c19ae99ad5d5 /Source
parent5dd953ca2c889321bb74967f21558907a1ad94c2 (diff)
parentda737d34e05d4a07b64596fc4970a0dd279a741d (diff)
downloadCMake-11b0ab167224d7bda2f7ccfacd026c322b4a1ca5.zip
CMake-11b0ab167224d7bda2f7ccfacd026c322b4a1ca5.tar.gz
CMake-11b0ab167224d7bda2f7ccfacd026c322b4a1ca5.tar.bz2
Merge topic 'cpack-pkg-domains'
da737d34e0 CPack/productbuild: add options to control domains element Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6825
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx37
-rw-r--r--Source/CPack/cmCPackPKGGenerator.h4
2 files changed, 40 insertions, 1 deletions
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index b62fab8..d8095cc 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -162,6 +162,8 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile,
CreateChoice(PostFlightComponent, xout);
}
+ this->CreateDomains(xout);
+
// default background
this->CreateBackground(nullptr, metapackageFile, genName, xout);
// Dark Aqua
@@ -273,7 +275,10 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
xout.Attribute("id", packageId);
xout.Attribute("version", this->GetOption("CPACK_PACKAGE_VERSION"));
xout.Attribute("installKBytes", installedSize);
- xout.Attribute("auth", "Admin");
+ // The auth attribute is deprecated in favor of the domains element
+ if (cmIsOff(this->GetOption("CPACK_PRODUCTBUILD_DOMAINS"))) {
+ xout.Attribute("auth", "Admin");
+ }
xout.Attribute("onConclusion", "None");
if (component.IsDownloaded) {
xout.Content(this->GetOption("CPACK_DOWNLOAD_SITE"));
@@ -286,6 +291,36 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
xout.EndElement(); // pkg-ref
}
+void cmCPackPKGGenerator::CreateDomains(cmXMLWriter& xout)
+{
+ std::string opt = "CPACK_PRODUCTBUILD_DOMAINS";
+ if (cmIsOff(this->GetOption(opt))) {
+ return;
+ }
+
+ xout.StartElement("domains");
+
+ // Product can be installed at the root of any volume by default
+ // unless specified
+ cmValue param = this->GetOption(cmStrCat(opt, "_ANYWHERE"));
+ xout.Attribute("enable_anywhere",
+ (param && cmIsOff(param)) ? "false" : "true");
+
+ // Product cannot be installed into the current user's home directory
+ // by default unless specified
+ param = this->GetOption(cmStrCat(opt, "_USER"));
+ xout.Attribute("enable_currentUserHome",
+ (param && cmIsOn(param)) ? "true" : "false");
+
+ // Product can be installed into the root directory by default
+ // unless specified
+ param = this->GetOption(cmStrCat(opt, "_ROOT"));
+ xout.Attribute("enable_localSystem",
+ (param && cmIsOff(param)) ? "false" : "true");
+
+ xout.EndElement();
+}
+
void cmCPackPKGGenerator::AddDependencyAttributes(
const cmCPackComponent& component,
std::set<const cmCPackComponent*>& visited, std::ostringstream& out)
diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h
index 5d97d16..256b334 100644
--- a/Source/CPack/cmCPackPKGGenerator.h
+++ b/Source/CPack/cmCPackPKGGenerator.h
@@ -91,6 +91,10 @@ protected:
void CreateBackground(const char* themeName, const char* metapackageFile,
cm::string_view genName, cmXMLWriter& xout);
+ /// Create the "domains" XML element to indicate where the product can
+ /// be installed
+ void CreateDomains(cmXMLWriter& xout);
+
// The PostFlight component when creating a metapackage
cmCPackComponent PostFlightComponent;
};