MantisBT - CMake
View Issue Details
0015841CMake(No Category)public2015-11-10 10:062016-06-10 14:31
Mark Stijnman 
Nils Gladitz 
normalminorhave not tried
closedmoved 
CMake 3.3.2 
 
0015841: CPack WiX generator should support component dependencies and default disabled components
For the common use case where multiple components depend on the same shared files (such as executables depending on DLLs), these shared components should automatically be installed when the user selects a component that depends on them, and not be installed if no depending components are selected. For that to work, the WiX generator should support the CPACK_COMPONENT_${COMPNAME}_DEPENDS and CPACK_COMPONENT_${COMPNAME}_DISABLED variables.
See attached file CMakeLists.txt. Run cmake and cpack to produce an installer. The installer defines 3 components, the first two of which depend on a component 'common', which is hidden and disabled by default.

The expected behavior is that 'common' is automatically installed if either 'comp1' or 'comp2' are selected, but not if only 'comp3' is selected.

The current behavior is that 'common' is always installed (which at least won't break the install due to missing dependencies).
Implementation suggestions:

1. Currently, each CPack component becomes a WiX Feature, and each file becomes a WiX Component, that is referenced from the feature. Dependencies can be implemented by also adding references to components from all features it depends on. Components that are installed more than once will be reference-counted. This is the standard way WiX installers deal with common files.

Downside: misses WiX components that were injected using separate fragments or patch mechanism. Also won't work with features that don't contain components at all, but for example a MergeRef (which is how I install Visual Studio C++ runtime libraries).

Variation: create a ComponentGroup for each feature, and add the component references there. This way, each feature just references its own component group, and references all component groups for featrues it depends on. This way you only have to define and emit the component list for each CPack component once. Otherwise, it has the same downsides as 1, except that it allows the user to inject WiX components in the ComponentGroup instead of in the Feature, which will make the dependencies work correctly again. (As an aside, it would be nice to have a mechanism to inject WiX Components by CPack component name, instead of by generated WiX Feature ID, which would be resilient against such implementation changes)

2. Generate a VB script file that implements a Custom Action, which reads and manipulates Session.FeatureRequestState based on the dependencies. The CA must then be inserted in the correct location of the install sequence.

Downside: seems much more complex to me.
No tags attached.
txt CMakeLists.txt (714) 2015-11-10 10:06
https://public.kitware.com/Bug/file/5572/CMakeLists.txt
Issue History
2015-11-10 10:06Mark StijnmanNew Issue
2015-11-10 10:06Mark StijnmanFile Added: CMakeLists.txt
2015-11-10 10:21Nils GladitzAssigned To => Nils Gladitz
2015-11-10 10:21Nils GladitzStatusnew => assigned
2016-06-10 14:29Kitware RobotNote Added: 0042885
2016-06-10 14:29Kitware RobotStatusassigned => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042885)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.