diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2017-02-03 08:02:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-02-06 19:53:16 (GMT) |
commit | 558a69fc90b5037c13c8335af41bbc9ec03b004e (patch) | |
tree | 2b208eef1d91d71b7f08aeaaf0c2260f346dca9e /Source/CPack | |
parent | fddc01bab3352d12c0eba1ff781b359a7dec529c (diff) | |
download | CMake-558a69fc90b5037c13c8335af41bbc9ec03b004e.zip CMake-558a69fc90b5037c13c8335af41bbc9ec03b004e.tar.gz CMake-558a69fc90b5037c13c8335af41bbc9ec03b004e.tar.bz2 |
CPackWIX: Introduce new CPACK_WIX_ROOT_FOLDER_ID variable
The new variable allows specification of a custom root folder ID.
The implicit default is "ProgramFiles<64>Folder".
The "<64>" token is replaced by "" for 32-bit and "64" for 64-bit builds.
Inspired-By: Eric Backus
Fixes: #16573
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.cxx | 20 | ||||
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.h | 2 |
2 files changed, 16 insertions, 6 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 2bccf2e..39586de 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -437,8 +437,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() directoryDefinitions.AddAttribute("Name", "SourceDir"); size_t installRootSize = - directoryDefinitions.BeginInstallationPrefixDirectory( - GetProgramFilesFolderId(), installRoot); + directoryDefinitions.BeginInstallationPrefixDirectory(GetRootFolderId(), + installRoot); std::string fileDefinitionsFilename = this->CPackTopLevel + "/files.wxs"; @@ -570,16 +570,26 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() return this->Patch->CheckForUnappliedFragments(); } -std::string cmCPackWIXGenerator::GetProgramFilesFolderId() const +std::string cmCPackWIXGenerator::GetRootFolderId() const { if (cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) { return ""; } + + std::string result = "ProgramFiles<64>Folder"; + + const char* rootFolderId = GetOption("CPACK_WIX_ROOT_FOLDER_ID"); + if (rootFolderId) { + result = rootFolderId; + } + if (GetArchitecture() == "x86") { - return "ProgramFilesFolder"; + cmSystemTools::ReplaceString(result, "<64>", ""); } else { - return "ProgramFiles64Folder"; + cmSystemTools::ReplaceString(result, "<64>", "64"); } + + return result; } bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate() diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index fc0994c..36647d8 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -65,7 +65,7 @@ private: bool CreateWiXSourceFiles(); - std::string GetProgramFilesFolderId() const; + std::string GetRootFolderId() const; bool GenerateMainSourceFileFromTemplate(); |