[CMake] CPack and WIX: Preselected components

Kyle Edwards kyle.edwards at kitware.com
Thu Jan 17 14:34:23 EST 2019


Micha,

Unfortunately, the WiX generator does not currently support component
installation, which is what's needed to make the INSTALL_TYPES argument
work.

We would welcome a merge request which adds this support.

Kyle

On Thu, 2019-01-17 at 19:28 +0100, Micha Renner wrote:
> With the NSIS generator I can create a dialog with a drop_down list
> with two elements default and developer. Default is selected by
> default
> when the dialog starts, so the default parts of the package are
> installed. Selecting developer the devlop parts are installed and the
> default files not. 
> 
> How can I do the same with the WiX generator?
> 
> With code below the WiX generator installs the complete package. 
> What I want is that the user can selected the develop part if he
> wants
> it.
> 
> 
> _______________________________________________________________
> Example as it works with NSIS. There is nothing specific for NSIS.
> 
> ADD_LIBRARY(mylib mylib.c)
> 
> ADD_EXECUTABLE(myapp myapp.c mylib.h)
> TARGET_LINK_LIBRARIES(myapp mylib)
> 
> INSTALL(TARGETS mylib ARCHIVE DESTINATION lib COMPONENT libraries)
> INSTALL(TARGETS myapp RUNTIME DESTINATION bin COMPONENT applications)
> INSTALL(FILES mylib.h DESTINATION include COMPONENT headers)
> INSTALL(FILES free.txt DESTINATION doc COMPONENT dokumentation)
> 
> # WIX specific
> SET(CPACK_WIX_UPGRADE_GUID 939B61C9-8E66-4876-A425-F7CDD7E6A6B2)
> SET(CPACK_GENERATOR WIX)
> 
> INCLUDE(CPackComponent)
> 
> cpack_add_install_type(Default DISPLAY_NAME Default)
> cpack_add_install_type(Developer)
> 
> cpack_add_component(applications DISPLAY_NAME "App" DESCRIPTION
> "Application only"
>     GROUP "Runtime" INSTALL_TYPES Default)
> 
> cpack_add_component(dokumentation DISPLAY_NAME "Doc" DESCRIPTION "Doc
> for the app"
>     GROUP "Runtime" INSTALL_TYPES Default)
> 	
> cpack_add_component(libraries DISPLAY_NAME "lib" DESCRIPTION "For
> devloper only"
> 	GROUP "Development" INSTALL_TYPES Developer)
> 
> cpack_add_component(headers DISPLAY_NAME "C++ Headers" DESCRIPTION
> "C/C++ header files for use with MyLib"
>     DEPENDS libraries INSTALL_TYPES Developer GROUP "Development")
> 
> cpack_add_component_group(Runtime)
> cpack_add_component_group(Development DESCRIPTION "All you need for
> development")
> 
> SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_PARENT_GROUP "Runtime")
> 
> INCLUDE(CPack)
> 


More information about the CMake mailing list