[Cmake-commits] CMake branch, next, updated. v3.7.2-1325-g30c8c9b

Brad King brad.king at kitware.com
Mon Feb 6 14:54:47 EST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  30c8c9bc75b387b1432a9c1cb5d4399bae163a71 (commit)
       via  558a69fc90b5037c13c8335af41bbc9ec03b004e (commit)
      from  86c53732c151f94749f375fe371e5db6f1f469e8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30c8c9bc75b387b1432a9c1cb5d4399bae163a71
commit 30c8c9bc75b387b1432a9c1cb5d4399bae163a71
Merge: 86c5373 558a69f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Feb 6 14:54:46 2017 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Feb 6 14:54:46 2017 -0500

    Merge topic 'wix-custom-root-id' into next
    
    558a69fc CPackWIX: Introduce new CPACK_WIX_ROOT_FOLDER_ID variable


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=558a69fc90b5037c13c8335af41bbc9ec03b004e
commit 558a69fc90b5037c13c8335af41bbc9ec03b004e
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Fri Feb 3 09:02:31 2017 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Feb 6 14:53:16 2017 -0500

    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

diff --git a/Help/release/dev/wix-custom-root-id.rst b/Help/release/dev/wix-custom-root-id.rst
new file mode 100644
index 0000000..3e10fdd
--- /dev/null
+++ b/Help/release/dev/wix-custom-root-id.rst
@@ -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``.
diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake
index 0f2278f..5a36e4c 100644
--- a/Modules/CPackWIX.cmake
+++ b/Modules/CPackWIX.cmake
@@ -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)
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();
 

-----------------------------------------------------------------------

Summary of changes:
 Help/release/dev/wix-custom-root-id.rst  |    7 +++++++
 Modules/CPackWIX.cmake                   |   11 +++++++++++
 Source/CPack/WiX/cmCPackWIXGenerator.cxx |   20 +++++++++++++++-----
 Source/CPack/WiX/cmCPackWIXGenerator.h   |    2 +-
 4 files changed, 34 insertions(+), 6 deletions(-)
 create mode 100644 Help/release/dev/wix-custom-root-id.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list