I'm writing an installer with CMake 2.8.11.2, CPack and NSIS. I came to the point where I need to call included sub-installers like MSVCR. Here is what my CMakeLists.txt looks like:
set(CPACK_GENERATOR NSIS)
list ( APPEND CPACK_NSIS_EXTRA_INSTALL_COMMANDS " ExecWait ./tmp/vcredist_x64.exe")
list ( APPEND CPACK_NSIS_EXTRA_INSTALL_COMMANDS " ExecWait ./tmp/some-other-installer.exe")
list ( APPEND CPACK_NSIS_EXTRA_INSTALL_COMMANDS " RMDir /r ./tmp/")
INCLUDE(CPack)
However, the generated .nsi file contains the following (single) line
ExecWait ./tmp/vcredist_x64.exe; ExecWait ./tmp/some-other-installer.exe; RMDir /r ./tmp/
which results in an error "ExecWait expects 1-2 parameters, got 6" while generating the package.
How can I pass multiple extra commands to NSIS correctly?
To add multiple commands, CPACK_NSIS_EXTRA_INSTALL_COMMANDS
needs to be set to a multi-line string:
list ( APPEND CPACK_NSIS_EXTRA_INSTALL_COMMANDS ...
...
string (REPLACE ";" "\n" CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}")
include(CPack)
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