Summary:
How to generate Wix installer with CMake/CPack?
Details:
I am trying to generate an installer out from a project that uses Wix, but apparently, cmake/cpack insist to use nsis, for example, from the repo https://github.com/ngladitz/cmake-wix-testsuite I picked the first example "basic" folder with the following contents for CMakeLists.txt
add_executable(hw hw.cpp)
install(TARGETS hw DESTINATION bin)
install(FILES hw.cpp DESTINATION src)
set(CPACK_WIX_UPGRADE_GUID "F9AAAAE2-D6AF-4EA4-BF46-B3E265400CC7")
include(CPack)
After generating the cmake:
cd <basic-root-folder>
mkdir MY_BUILD
cd MY_BUILD
cmake ..
I tried to run the package.vcxproj generated with
msbuild package.vcxproj
and got the error
"C:\src\Samples\CPack\cmake-wix-testsuite-master\basic\MY_BUILD\PACKAGE.vcxproj " (default target) (1) -> (PostBuildEvent target) -> EXEC : CPack error : Cannot find NSIS compiler makensis: likely it is not ins talled, or not in your PATH [C:\src\Samples\CPack\cmake-wix-testsuite-master\ba sic\MY_BUILD\PACKAGE.vcxproj]
So it looks like it insist in using the NSIS generator.
Simply add following line before include(CPack)
set(CPACK_GENERATOR WIX)
You can also do this:
cmake ..
cpack -G WIX
By default, CPack uses the NSIS Generator on Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With