mirror of
https://github.com/reactos/CMake.git
synced 2025-01-23 12:15:20 +00:00
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
This commit is contained in:
parent
fddc01bab3
commit
558a69fc90
7
Help/release/dev/wix-custom-root-id.rst
Normal file
7
Help/release/dev/wix-custom-root-id.rst
Normal file
@ -0,0 +1,7 @@
|
||||
wix-custom-root-id
|
||||
------------------
|
||||
|
||||
* The CPack WIX generator implemented a new
|
||||
:variable:`CPACK_WIX_ROOT_FOLDER_ID` variable which allows
|
||||
using a custom root folder ID instead of the default
|
||||
``ProgramFilesFolder`` / ``ProgramFiles64Folder``.
|
@ -268,6 +268,17 @@
|
||||
# follow the localization or convention of the system on which the
|
||||
# installation is performed.
|
||||
#
|
||||
# .. variable:: CPACK_WIX_ROOT_FOLDER_ID
|
||||
#
|
||||
# This variable allows specification of a custom root folder ID.
|
||||
# The generator specific ``<64>`` token can be used for
|
||||
# folder IDs that come in 32-bit and 64-bit variants.
|
||||
# In 32-bit builds the token will expand empty while in 64-bit builds
|
||||
# it will expand to ``64``.
|
||||
#
|
||||
# When unset generated installers will default installing to
|
||||
# ``ProgramFiles<64>Folder``.
|
||||
#
|
||||
|
||||
if(NOT CPACK_WIX_ROOT)
|
||||
file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT)
|
||||
|
@ -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 "";
|
||||
}
|
||||
if (GetArchitecture() == "x86") {
|
||||
return "ProgramFilesFolder";
|
||||
} else {
|
||||
return "ProgramFiles64Folder";
|
||||
|
||||
std::string result = "ProgramFiles<64>Folder";
|
||||
|
||||
const char* rootFolderId = GetOption("CPACK_WIX_ROOT_FOLDER_ID");
|
||||
if (rootFolderId) {
|
||||
result = rootFolderId;
|
||||
}
|
||||
|
||||
if (GetArchitecture() == "x86") {
|
||||
cmSystemTools::ReplaceString(result, "<64>", "");
|
||||
} else {
|
||||
cmSystemTools::ReplaceString(result, "<64>", "64");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
|
||||
|
@ -65,7 +65,7 @@ private:
|
||||
|
||||
bool CreateWiXSourceFiles();
|
||||
|
||||
std::string GetProgramFilesFolderId() const;
|
||||
std::string GetRootFolderId() const;
|
||||
|
||||
bool GenerateMainSourceFileFromTemplate();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user