summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2014-03-01 23:51:42 (GMT)
committerNils Gladitz <nilsgladitz@gmail.com>2014-03-01 23:51:42 (GMT)
commit642fa25da095b346d559ad39624eda79b0bd2ff8 (patch)
tree9d0dcaa3090d92ec1478d6ca03f7967628cd262e /Source
parent378eb5b712bb8f131e62aa343e3ec27d446dc098 (diff)
downloadCMake-642fa25da095b346d559ad39624eda79b0bd2ff8.zip
CMake-642fa25da095b346d559ad39624eda79b0bd2ff8.tar.gz
CMake-642fa25da095b346d559ad39624eda79b0bd2ff8.tar.bz2
CPackWIX: support installation of empty directories
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx10
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.cxx22
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.h4
3 files changed, 36 insertions, 0 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 1ba43b3..a385e40 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -814,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/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,