[CMake] WIX installer fails for shared files

Mark Stijnman mark.stijnman at gmail.com
Fri Nov 6 14:06:36 EST 2015


I'm using CPack with WIX to create multi-component installers, and I'm
having issues with components (or WIX features) that share files. A common
use case would be two executables which require the same DLLs. To reproduce
the issue, you can use following minimal CMakeLists.txt with three text
files 1.txt, 2.txt and common.txt:
@
install(FILES 1.txt common.txt DESTINATION bin COMPONENT comp1)
install(FILES 2.txt common.txt DESTINATION bin COMPONENT comp2)
set(CPACK_GENERATOR WIX)
set(CPACK_COMPONENTS_ALL comp1 comp2)
include(CPack)
@

running cmake and then cpack results in:
CPack Error: Fatal WiX Generator Error
CPack Error: Problem compressing the directory
CPack Error: Error when generating package: Project

In wix.log, you will find the real error:
error LGHT0369 : Component/@Id='CM_CP_comp2.bin.common.txt' has a @Guid
value '{8D160A50-70B9-5BCA-8491-AB9A79C696F3}' that duplicates another
component in this package. It is recommended to give each component its own
unique GUID.

This seems to be caused by the fact that CPack makes separate staging
folders for each component, so that comp1\bin\common.txt and
comp2\bin\common.txt are different files to CPack. However, since they both
install to bin\common.txt, WIX thinks they should be the same file with the
same GUID.

A partial workaround is to put shared files in a separate, hidden CPack
component/WIX feature, and set component dependencies. However, with many
shared DLLs, maintaining this gets complex really fast, so I'd rather not
have to do this.

So how can I get the WIX generator to do this the WIX way: generate just
one entry for a common file, and reference that entry from both features?

As an aside, is it really necessary to have separate staging folders for
each component? It should be safe to just have one staging folder, unless
two components in the same package install two different files to the same
destination - but shouldn't that be an error that CPack should check for
anyway?

best regards Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151106/9bd7e5ae/attachment.html>


More information about the CMake mailing list