[CMake] CPack install commands -- CPACK_NSIS_EXTRA_INSTALL_COMMANDS

David Cole david.cole at kitware.com
Thu Sep 28 10:06:21 EDT 2006


Something like this in your CMakeLists.txt prior to "INCLUDE(CPack)":

  IF(WIN32)
    SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
  ExecWait '\\\"$INSTDIR\\\\vcredist_x86.exe\\\" /install'
")

    SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
  ExecWait '\\\"$INSTDIR\\\\vcredist_x86.exe\\\" /uninstall'
")
  ENDIF(WIN32)

You'll have to read up on vcredist_x86.exe, though. I just made up 
"/install" and "/uninstall"... They may or may not even support 
/uninstall for that package, I don't know...

You'll notice that the escaped versions of these lines show up in the 
NSIS input file 
"${CMAKE_BINARY_DIR}/_CPack_Packages/win32/NSIS/project.nsi"... The 
double backslashes are ugly, but the string goes through two configures, 
so they're necessary with CMake 2.4.

The example assumes that you've first installed the exe in the root 
$INSTDIR of the NSIS installation. If you can figure out the correct NSI 
incantation to run it directly without installing it or to run it from 
CD or network location, that should work too. I'm not an NSI expert by 
any means, just enough to have figured out how to pass a simple ExecWait 
call through like so...

Hope this helps,
David


Bill Katz wrote:

> Hi,
> I'm using CPack to generate a Windows installer for a simulation
> package. The code was compiled using VS 2005, and I'd like NSIS to
> execute the Microsoft-supplied vcredist_x86.exe during install. How
> would I do this?
>
> I noticed the CPACK_NSIS_EXTRA_INSTALL_COMMANDS variable, but I
> haven't found any documentation on its use.
> Thanks for any help.
> -Bill
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list