[Cmake-commits] CMake branch, next, updated. v3.6.1-1813-gd7cc684

Nils Gladitz nilsgladitz at gmail.com
Tue Sep 6 11:45:59 EDT 2016


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  d7cc6846e9bfce3f59161ee1485b181039276d6a (commit)
       via  1bc33257d48bb4b54333b755951967c6c3fa1df6 (commit)
      from  246539626a1dc8558202bd0b9a343b3e0af1f426 (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=d7cc6846e9bfce3f59161ee1485b181039276d6a
commit d7cc6846e9bfce3f59161ee1485b181039276d6a
Merge: 2465396 1bc3325
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Tue Sep 6 11:45:58 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Sep 6 11:45:58 2016 -0400

    Merge topic 'wix-fix-static-prefix' into next
    
    1bc33257 CPackWIX: Fix incomplete CPACK_WIX_SKIP_PROGRAM_FOLDER implementation


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bc33257d48bb4b54333b755951967c6c3fa1df6
commit 1bc33257d48bb4b54333b755951967c6c3fa1df6
Author:     Michael Stürmer <michael.stuermer at schaeffler.com>
AuthorDate: Tue Sep 6 12:11:00 2016 +0200
Commit:     Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Tue Sep 6 17:44:48 2016 +0200

    CPackWIX: Fix incomplete CPACK_WIX_SKIP_PROGRAM_FOLDER implementation
    
    Commit 17bbf6af (CPackWIX: Implement new CPACK_WIX_SKIP_PROGRAM_FOLDER
    feature) generates GUIDs for most but not all components
    when the feature is active.
    
    Generate the remaining GUIDs as well.
    
    Co-Author: Nils Gladitz <nilsgladitz at gmail.com>

diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index d7f69a1..85e0ae3 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -35,6 +35,7 @@
 
 cmCPackWIXGenerator::cmCPackWIXGenerator()
   : Patch(0)
+  , ComponentGuidType(cmWIXSourceWriter::WIX_GENERATED_GUID)
 {
 }
 
@@ -234,6 +235,12 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
     }
   }
 
+  // if install folder is supposed to be set absolutely, the default
+  // component guid "*" cannot be used
+  if (cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) {
+    this->ComponentGuidType = cmWIXSourceWriter::CMAKE_GENERATED_GUID;
+  }
+
   return true;
 }
 
@@ -317,7 +324,9 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile()
 {
   std::string includeFilename = this->CPackTopLevel + "/cpack_variables.wxi";
 
-  cmWIXSourceWriter includeFile(this->Logger, includeFilename, true);
+  cmWIXSourceWriter includeFile(this->Logger, includeFilename,
+                                this->ComponentGuidType,
+                                cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT);
 
   CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID");
   CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID");
@@ -338,7 +347,9 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile()
 {
   std::string includeFilename = this->CPackTopLevel + "/properties.wxi";
 
-  cmWIXSourceWriter includeFile(this->Logger, includeFilename, true);
+  cmWIXSourceWriter includeFile(this->Logger, includeFilename,
+                                this->ComponentGuidType,
+                                cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT);
 
   std::string prefix = "CPACK_WIX_PROPERTY_";
   std::vector<std::string> options = GetOptions();
@@ -386,7 +397,9 @@ void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile()
 {
   std::string includeFilename = this->CPackTopLevel + "/product_fragment.wxi";
 
-  cmWIXSourceWriter includeFile(this->Logger, includeFilename, true);
+  cmWIXSourceWriter includeFile(this->Logger, includeFilename,
+                                this->ComponentGuidType,
+                                cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT);
 
   this->Patch->ApplyFragment("#PRODUCT", includeFile);
 }
@@ -413,13 +426,15 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source,
 
 bool cmCPackWIXGenerator::CreateWiXSourceFiles()
 {
+  // if install folder is supposed to be set absolutely, the default
+  // component guid "*" cannot be used
   std::string directoryDefinitionsFilename =
     this->CPackTopLevel + "/directories.wxs";
 
   this->WixSources.push_back(directoryDefinitionsFilename);
 
   cmWIXDirectoriesSourceWriter directoryDefinitions(
-    this->Logger, directoryDefinitionsFilename);
+    this->Logger, directoryDefinitionsFilename, this->ComponentGuidType);
   directoryDefinitions.BeginElement("Fragment");
 
   std::string installRoot;
@@ -439,13 +454,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
 
   this->WixSources.push_back(fileDefinitionsFilename);
 
-  cmWIXFilesSourceWriter fileDefinitions(this->Logger,
-                                         fileDefinitionsFilename);
-
-  // if install folder is supposed to be set absolutely, the default
-  // component guid "*" cannot be used
-  fileDefinitions.GenerateComponentGuids =
-    cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"));
+  cmWIXFilesSourceWriter fileDefinitions(this->Logger, fileDefinitionsFilename,
+                                         this->ComponentGuidType);
 
   fileDefinitions.BeginElement("Fragment");
 
@@ -454,8 +464,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
 
   this->WixSources.push_back(featureDefinitionsFilename);
 
-  cmWIXFeaturesSourceWriter featureDefinitions(this->Logger,
-                                               featureDefinitionsFilename);
+  cmWIXFeaturesSourceWriter featureDefinitions(
+    this->Logger, featureDefinitionsFilename, this->ComponentGuidType);
 
   featureDefinitions.BeginElement("Fragment");
 
@@ -764,7 +774,8 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
 
   fileDefinitions.BeginElement("Component");
   fileDefinitions.AddAttribute("Id", componentId);
-  fileDefinitions.AddAttribute("Guid", "*");
+  fileDefinitions.AddAttribute(
+    "Guid", fileDefinitions.CreateGuidFromComponentId(componentId));
 
   this->Patch->ApplyFragment(componentId, fileDefinitions);
 
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 9d3a522..883df9a 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -162,6 +162,8 @@ private:
   std::string CPackTopLevel;
 
   cmWIXPatch* Patch;
+
+  cmWIXSourceWriter::GuidType ComponentGuidType;
 };
 
 #endif
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
index 97e3a51..9704195 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
@@ -13,8 +13,8 @@
 #include "cmWIXDirectoriesSourceWriter.h"
 
 cmWIXDirectoriesSourceWriter::cmWIXDirectoriesSourceWriter(
-  cmCPackLog* logger, std::string const& filename)
-  : cmWIXSourceWriter(logger, filename)
+  cmCPackLog* logger, std::string const& filename, GuidType componentGuidType)
+  : cmWIXSourceWriter(logger, filename, componentGuidType)
 {
 }
 
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
index 023f4b8..6ebe281 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
@@ -25,8 +25,8 @@
 class cmWIXDirectoriesSourceWriter : public cmWIXSourceWriter
 {
 public:
-  cmWIXDirectoriesSourceWriter(cmCPackLog* logger,
-                               std::string const& filename);
+  cmWIXDirectoriesSourceWriter(cmCPackLog* logger, std::string const& filename,
+                               GuidType componentGuidType);
 
   void EmitStartMenuFolder(std::string const& startMenuFolder);
 
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
index 1747b62..7794935 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
@@ -13,8 +13,8 @@
 #include "cmWIXFeaturesSourceWriter.h"
 
 cmWIXFeaturesSourceWriter::cmWIXFeaturesSourceWriter(
-  cmCPackLog* logger, std::string const& filename)
-  : cmWIXSourceWriter(logger, filename)
+  cmCPackLog* logger, std::string const& filename, GuidType componentGuidType)
+  : cmWIXSourceWriter(logger, filename, componentGuidType)
 {
 }
 
@@ -24,7 +24,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry(
   BeginElement("Component");
   AddAttribute("Id", "CM_PACKAGE_REGISTRY");
   AddAttribute("Directory", "TARGETDIR");
-  AddAttribute("Guid", "*");
+  AddAttribute("Guid", CreateGuidFromComponentId("CM_PACKAGE_REGISTRY"));
 
   std::string registryKey =
     std::string("Software\\Kitware\\CMake\\Packages\\") + package;
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
index ee9c17a..9974b63 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
@@ -23,7 +23,8 @@
 class cmWIXFeaturesSourceWriter : public cmWIXSourceWriter
 {
 public:
-  cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename);
+  cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename,
+                            GuidType componentGuidType);
 
   void CreateCMakePackageRegistryEntry(std::string const& package,
                                        std::string const& upgradeGuid);
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
index dde9635..846edde 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
@@ -24,9 +24,9 @@
 #include <sys/stat.h>
 
 cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger,
-                                               std::string const& filename)
-  : cmWIXSourceWriter(logger, filename)
-  , GenerateComponentGuids(false)
+                                               std::string const& filename,
+                                               GuidType componentGuidType)
+  : cmWIXSourceWriter(logger, filename, componentGuidType)
 {
 }
 
@@ -130,13 +130,7 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
   std::string componentId = std::string("CM_C") + id;
   std::string fileId = std::string("CM_F") + id;
 
-  std::string guid = "*";
-  if (this->GenerateComponentGuids) {
-    std::string md5 = cmSystemTools::ComputeStringMD5(componentId);
-    cmUuid uuid;
-    std::vector<unsigned char> ns;
-    guid = uuid.FromMd5(ns, md5);
-  }
+  std::string guid = CreateGuidFromComponentId(componentId);
 
   BeginElement("DirectoryRef");
   AddAttribute("Id", directoryId);
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
index eeb84cb..c1952af 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
@@ -26,7 +26,8 @@
 class cmWIXFilesSourceWriter : public cmWIXSourceWriter
 {
 public:
-  cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename);
+  cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename,
+                         GuidType componentGuidType);
 
   void EmitShortcut(std::string const& id, cmWIXShortcut const& shortcut,
                     std::string const& shortcutPrefix, size_t shortcutIndex);
@@ -47,8 +48,6 @@ public:
                                 std::string const& id,
                                 std::string const& filePath, cmWIXPatch& patch,
                                 cmInstalledFile const* installedFile);
-
-  bool GenerateComponentGuids;
 };
 
 #endif
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx
index 2c0384e..a287424 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx
@@ -14,19 +14,23 @@
 
 #include <CPack/cmCPackGenerator.h>
 
+#include <cmUuid.h>
+
 #include <windows.h>
 
 cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger,
                                      std::string const& filename,
-                                     bool isIncludeFile)
+                                     GuidType componentGuidType,
+                                     RootElementType rootElementType)
   : Logger(logger)
   , File(filename.c_str())
   , State(DEFAULT)
   , SourceFilename(filename)
+  , ComponentGuidType(componentGuidType)
 {
   WriteXMLDeclaration();
 
-  if (isIncludeFile) {
+  if (rootElementType == INCLUDE_ELEMENT_ROOT) {
     BeginElement("Include");
   } else {
     BeginElement("Wix");
@@ -173,6 +177,19 @@ std::string cmWIXSourceWriter::CMakeEncodingToUtf8(std::string const& value)
 #endif
 }
 
+std::string cmWIXSourceWriter::CreateGuidFromComponentId(
+  std::string const& componentId)
+{
+  std::string guid = "*";
+  if (this->ComponentGuidType == CMAKE_GENERATED_GUID) {
+    std::string md5 = cmSystemTools::ComputeStringMD5(componentId);
+    cmUuid uuid;
+    std::vector<unsigned char> ns;
+    guid = uuid.FromMd5(ns, md5);
+  }
+  return guid;
+}
+
 void cmWIXSourceWriter::WriteXMLDeclaration()
 {
   File << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h
index 4efc026..c29ffa7 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXSourceWriter.h
@@ -26,8 +26,21 @@
 class cmWIXSourceWriter
 {
 public:
+  enum GuidType
+  {
+    WIX_GENERATED_GUID,
+    CMAKE_GENERATED_GUID
+  };
+
+  enum RootElementType
+  {
+    WIX_ELEMENT_ROOT,
+    INCLUDE_ELEMENT_ROOT
+  };
+
   cmWIXSourceWriter(cmCPackLog* logger, std::string const& filename,
-                    bool isIncludeFile = false);
+                    GuidType componentGuidType,
+                    RootElementType rootElementType = WIX_ELEMENT_ROOT);
 
   ~cmWIXSourceWriter();
 
@@ -45,6 +58,8 @@ public:
   void AddAttributeUnlessEmpty(std::string const& key,
                                std::string const& value);
 
+  std::string CreateGuidFromComponentId(std::string const& componentId);
+
   static std::string CMakeEncodingToUtf8(std::string const& value);
 
 protected:
@@ -70,6 +85,8 @@ private:
   std::vector<std::string> Elements;
 
   std::string SourceFilename;
+
+  GuidType ComponentGuidType;
 };
 
 #endif

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

Summary of changes:
 Source/CPack/WiX/cmCPackWIXGenerator.cxx          |   39 +++++++++++++--------
 Source/CPack/WiX/cmCPackWIXGenerator.h            |    2 ++
 Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx |    4 +--
 Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h   |    4 +--
 Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx    |    6 ++--
 Source/CPack/WiX/cmWIXFeaturesSourceWriter.h      |    3 +-
 Source/CPack/WiX/cmWIXFilesSourceWriter.cxx       |   14 +++-----
 Source/CPack/WiX/cmWIXFilesSourceWriter.h         |    5 ++-
 Source/CPack/WiX/cmWIXSourceWriter.cxx            |   21 +++++++++--
 Source/CPack/WiX/cmWIXSourceWriter.h              |   19 +++++++++-
 10 files changed, 79 insertions(+), 38 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list