Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CPack: How to perform multiple CPACK_NSIS_EXTRA_INSTALL_COMMANDS?

Tags:

cmake

nsis

cpack

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?

like image 949
Manuel Barbe Avatar asked Mar 15 '23 13:03

Manuel Barbe


1 Answers

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)
like image 129
sakra Avatar answered Mar 19 '23 22:03

sakra