summaryrefslogtreecommitdiffstats
path: root/Source/CPack/WiX
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2014-01-08 00:28:24 (GMT)
committerNils Gladitz <nilsgladitz@gmail.com>2014-01-08 00:28:24 (GMT)
commit92c4d4039e6f3c981e8b42d98240e53b8c33bdaf (patch)
tree27e5cc0ea5db416467fad7a197f19829e9af2d8a /Source/CPack/WiX
parent855e8759fdf20a209f19f02e8dc5d203f4713a6a (diff)
downloadCMake-92c4d4039e6f3c981e8b42d98240e53b8c33bdaf.zip
CMake-92c4d4039e6f3c981e8b42d98240e53b8c33bdaf.tar.gz
CMake-92c4d4039e6f3c981e8b42d98240e53b8c33bdaf.tar.bz2
CPackWiX: added new CPACK_WIX_CMAKE_PACKAGE_REGISTRY variable
Allows automatic registration of installed packages with the cmake package registry.
Diffstat (limited to 'Source/CPack/WiX')
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx43
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h3
2 files changed, 45 insertions, 1 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index a55a6a6..998b5f1 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -437,7 +437,15 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
featureDefinitions.AddAttribute("Level", "1");
- CreateFeatureHierarchy(featureDefinitions);
+ if(!CreateCMakePackageRegistryEntry(featureDefinitions))
+ {
+ return false;
+ }
+
+ if(!CreateFeatureHierarchy(featureDefinitions))
+ {
+ return false;
+ }
featureDefinitions.EndElement("Feature");
@@ -564,6 +572,39 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
return true;
}
+bool cmCPackWIXGenerator::CreateCMakePackageRegistryEntry(
+ cmWIXSourceWriter& featureDefinitions)
+{
+ const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY");
+ if(!package)
+ {
+ return true;
+ }
+
+ featureDefinitions.BeginElement("Component");
+ featureDefinitions.AddAttribute("Id", "CM_PACKAGE_REGISTRY");
+ featureDefinitions.AddAttribute("Directory", "TARGETDIR");
+ featureDefinitions.AddAttribute("Guid", "*");
+
+ std::string registryKey =
+ std::string("Software\\Kitware\\CMake\\Packages\\") + package;
+
+ std::string upgradeGuid = GetOption("CPACK_WIX_UPGRADE_GUID");
+
+ featureDefinitions.BeginElement("RegistryValue");
+ featureDefinitions.AddAttribute("Root", "HKLM");
+ featureDefinitions.AddAttribute("Key", registryKey);
+ featureDefinitions.AddAttribute("Name", upgradeGuid);
+ featureDefinitions.AddAttribute("Type", "string");
+ featureDefinitions.AddAttribute("Value", "[INSTALL_ROOT]");
+ featureDefinitions.AddAttribute("KeyPath", "yes");
+ featureDefinitions.EndElement("RegistryValue");
+
+ featureDefinitions.EndElement("Component");
+
+ return true;
+}
+
bool cmCPackWIXGenerator::CreateFeatureHierarchy(
cmWIXSourceWriter& featureDefinitions)
{
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 0a85ae2..1f4facf 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -81,6 +81,9 @@ private:
bool CreateWiXSourceFiles();
+ bool CreateCMakePackageRegistryEntry(
+ cmWIXSourceWriter& featureDefinitions);
+
bool CreateFeatureHierarchy(
cmWIXSourceWriter& featureDefinitions);