diff options
author | Brad King <brad.king@kitware.com> | 2014-03-03 15:06:25 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-03-03 15:06:25 (GMT) |
commit | 909c0533d0422e9c3204e2d7b58a18b208c7e695 (patch) | |
tree | 8d1da127e924b6efd141381108a7c7b7d1338863 /Source | |
parent | d57bc8797d36b7a267a15063b3248f8461b3e648 (diff) | |
parent | 642fa25da095b346d559ad39624eda79b0bd2ff8 (diff) | |
download | CMake-909c0533d0422e9c3204e2d7b58a18b208c7e695.zip CMake-909c0533d0422e9c3204e2d7b58a18b208c7e695.tar.gz CMake-909c0533d0422e9c3204e2d7b58a18b208c7e695.tar.bz2 |
Merge topic 'wix-additions'
642fa25d CPackWIX: support installation of empty directories
378eb5b7 CPackWIX: Allow Windows Installer property customization
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.cxx | 47 | ||||
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.h | 2 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXFilesSourceWriter.cxx | 22 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXFilesSourceWriter.h | 4 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.h | 1 |
6 files changed, 82 insertions, 0 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 8e671cc..a385e40 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -215,6 +215,13 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() SetOption("CPACK_WIX_UI_REF", defaultRef.c_str()); } + const char* packageContact = GetOption("CPACK_PACKAGE_CONTACT"); + if(packageContact != 0 && + GetOption("CPACK_WIX_PROPERTY_ARPCONTACT") == 0) + { + SetOption("CPACK_WIX_PROPERTY_ARPCONTACT", packageContact); + } + CollectExtensions("CPACK_WIX_EXTENSIONS", this->CandleExtensions); CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", this->CandleExtensions); @@ -239,6 +246,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl() } CreateWiXVariablesIncludeFile(); + CreateWiXPropertiesIncludeFile(); if(!CreateWiXSourceFiles()) { @@ -315,6 +323,35 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() CopyDefinition(includeFile, "CPACK_WIX_UI_REF"); } +void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() +{ + std::string includeFilename = + this->CPackTopLevel + "/properties.wxi"; + + cmWIXSourceWriter includeFile( + this->Logger, includeFilename, true); + + std::string prefix = "CPACK_WIX_PROPERTY_"; + std::vector<std::string> options = GetOptions(); + + for(size_t i = 0; i < options.size(); ++i) + { + std::string const& name = options[i]; + + if(name.length() > prefix.length() && + name.substr(0, prefix.length()) == prefix) + { + std::string id = name.substr(prefix.length()); + std::string value = GetOption(name.c_str()); + + includeFile.BeginElement("Property"); + includeFile.AddAttribute("Id", id); + includeFile.AddAttribute("Value", value); + includeFile.EndElement("Property"); + } + } +} + void cmCPackWIXGenerator::CopyDefinition( cmWIXSourceWriter &source, std::string const& name) { @@ -777,6 +814,16 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( cmsys::Directory dir; dir.Load(topdir.c_str()); + if(dir.GetNumberOfFiles() == 2) + { + std::string componentId = fileDefinitions.EmitComponentCreateFolder( + directoryId, GenerateGUID()); + + featureDefinitions.EmitComponentRef(componentId); + + return; + } + for(size_t i = 0; i < dir.GetNumberOfFiles(); ++i) { std::string fileName = dir.GetFile(static_cast<unsigned long>(i)); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index ee66c05..4c9f8c7 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -73,6 +73,8 @@ private: void CreateWiXVariablesIncludeFile(); + void CreateWiXPropertiesIncludeFile(); + void CopyDefinition( cmWIXSourceWriter &source, std::string const& name); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index 0835f3a..3fd959e 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -109,6 +109,28 @@ void cmWIXFilesSourceWriter::EmitUninstallShortcut( EndElement("Shortcut"); } +std::string cmWIXFilesSourceWriter::EmitComponentCreateFolder( + std::string const& directoryId, std::string const& guid) +{ + std::string componentId = + std::string("CM_C_EMPTY_") + directoryId; + + BeginElement("DirectoryRef"); + AddAttribute("Id", directoryId); + + BeginElement("Component"); + AddAttribute("Id", componentId); + AddAttribute("Guid", guid); + + BeginElement("CreateFolder"); + + EndElement("CreateFolder"); + EndElement("Component"); + EndElement("DirectoryRef"); + + return componentId; +} + std::string cmWIXFilesSourceWriter::EmitComponentFile( std::string const& directoryId, std::string const& id, diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index d22d270..13122c2 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -45,6 +45,10 @@ public: void EmitUninstallShortcut(std::string const& packageName); + std::string EmitComponentCreateFolder( + std::string const& directoryId, + std::string const& guid); + std::string EmitComponentFile( std::string const& directoryId, std::string const& id, diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 96491aa..e1dd4e9 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1202,6 +1202,12 @@ const char* cmCPackGenerator::GetOption(const char* op) const } //---------------------------------------------------------------------- +std::vector<std::string> cmCPackGenerator::GetOptions() const +{ + return this->MakefileMap->GetDefinitions(); +} + +//---------------------------------------------------------------------- int cmCPackGenerator::PackageFiles() { return 0; diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index bb33aa0..b1a7840 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -102,6 +102,7 @@ public: void SetOption(const char* op, const char* value); void SetOptionIfNotSet(const char* op, const char* value); const char* GetOption(const char* op) const; + std::vector<std::string> GetOptions() const; bool IsSet(const char* name) const; bool IsOn(const char* name) const; |