CPack/WiX: Allow multiple empty top-level components

Avoid generating empty / conflicting directory components for
the installation root which is shared across components and
(except for the degenerate case of an empty installer)
will always be created implicitly.
This commit is contained in:
Nils Gladitz
2025-09-11 14:36:10 +02:00
parent 50e5040cda
commit 6e3f6e925d
4 changed files with 11 additions and 0 deletions

View File

@@ -1015,6 +1015,10 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions(
if (emptyDirectory) {
createDirectory = true;
if (directoryId == "INSTALL_ROOT") {
return;
}
}
if (directoryInstalledFile) {

View File

@@ -3,6 +3,8 @@ CPack: Install projects
CPack: - Install project: CPackWiXGenerator \[Release\]
CPack: - Install component: applications
CPack: - Install component: applications2
CPack: - Install component: empty1
CPack: - Install component: empty2
CPack: - Install component: extras
CPack: - Install component: headers
CPack: - Install component: libraries

View File

@@ -3,6 +3,8 @@ CPack: Install projects
CPack: - Install project: CPackWiXGenerator \[Release\]
CPack: - Install component: applications
CPack: - Install component: applications2
CPack: - Install component: empty1
CPack: - Install component: empty2
CPack: - Install component: extras
CPack: - Install component: headers
CPack: - Install component: libraries

View File

@@ -33,6 +33,9 @@ install(FILES mylib.h "file with spaces.h"
DESTINATION include
COMPONENT headers)
install(CODE "" COMPONENT "empty1")
install(CODE "" COMPONENT "empty2")
set(CPACK_GENERATOR "WIX")
set(CPACK_PACKAGE_NAME "MyLib")