CPackWIX: support installation of empty directories
This commit is contained in:
parent
378eb5b712
commit
642fa25da0
|
@ -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));
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -9,6 +9,11 @@ target_link_libraries(my-libapp mylib)
|
|||
|
||||
add_executable(my-other-app myotherapp.cpp)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty
|
||||
DESTINATION extras
|
||||
COMPONENT extras)
|
||||
|
||||
install(TARGETS mylib
|
||||
ARCHIVE
|
||||
DESTINATION lib
|
||||
|
@ -72,6 +77,12 @@ cpack_add_component_group(Development
|
|||
EXPANDED
|
||||
DESCRIPTION "All of the tools you'll ever need to develop software")
|
||||
|
||||
cpack_add_component(extras
|
||||
DISPLAY_NAME "Extras"
|
||||
DESCRIPTION "Extras"
|
||||
GROUP Runtime
|
||||
INSTALL_TYPES Full)
|
||||
|
||||
cpack_add_component(applications
|
||||
REQUIRED
|
||||
DISPLAY_NAME "MyLib Application"
|
||||
|
|
Loading…
Reference in New Issue