Reputation: 8396
We are venturing in the idea to port our WiX based msi
generation to CPackWIX
, for our CMake projects.
It seems that the idea behind CPackWIX
is to use heat.exe
to create an installer that contains exactly the file present in the install directory. Is it possible to feed a custom wxs
file instead?
The idea would be to then leverage the CPack integration in our development environment, i.e. the package
target, while keeping complete control regarding the WiX descriptions used to create the msi
installer.
Upvotes: 1
Views: 1073
Reputation: 6744
You can use the CPACK_WIX_TEMPLATE
variable for that.
I have a custom wxs file for my installer that includes a custom wxi file. In my default installers I do it the following way:
install(TARGETS yourTarget EXPORT "${PROJECT_NAME}${PROJECT_VERSION}"
COMPONENT AppBinaries
LIBRARY DESTINATION bin
RUNTIME DESTINATION bin CONFIGURATIONS Release)
# this file is copied and renamed to main.wxs by CPack
set(CPACK_WIX_TEMPLATE "${CMAKE_SOURCE_DIR}/packageInstallerCPack.wxs.in")
set(CPACK_WIX_UI_REF "WixUI_FeatureTree")
set(CPACK_WIX_EXTENSIONS "WixUtilExtension")
configure_file("${CMAKE_SOURCE_DIR}/packageDefinesCPack.wxi.in" "${CMAKE_BINARY_DIR}/packageDefinesCPack.wxi" @ONLY)
set(CPACK_WIX_CANDLE_EXTRA_FLAGS "-I${CMAKE_BINARY_DIR}") # for packageDefinesCPack.wxi to work
set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-loc" "${CMAKE_SOURCE_DIR}/AdditionalWixUI_en-us.wxl") # for localization to work, not needed now, but who knows
include(CPack)
include(CPackWIX)
cpack_add_component(AppBinaries DISPLAY_NAME "Binaries" DESCRIPTION "${CPACK_PACKAGE_NAME} Binaries")
To build my MSI package I use cpack -C Release -G WIX
.
Upvotes: 1