[CMake] [CPACK] Add and define an environment variable for NSIS

Eric Noulard eric.noulard at gmail.com
Tue Jan 18 05:17:03 EST 2011


2011/1/18 Olivier Pierard <olivier.pierard at cenaero.be>:
> Dear all,
>
> I would like to add a step for our NSIS installer in order to define an
> environment variable to locate a license file which is sent separately
> to the package (best would be locating it through a 'browse' button).
>
> I'm a little bit lost in the CPack files organization so if someone
> could give me some hints on the best practice to do so, I would be very
> grateful.  Should I use the CPACK_EXTRA_INSTALL_COMMAND ?  Should I copy
> and modify NSIS.InstallOptions.ini.in and/or NSIS.template.in ?

Both ways are OK.
If you think your enhancement may be useful to others then I suggest
you modify the template NSIS.InstallOptions.ini.in and/or NSIS.template.in
(in a backward compatible manner). And propose a patch for those to be
included in CPack/CMake upstream.

In the meantime you can keep your specific template files in your
project and modify
CMAKE_MODULE_PATH in order to make CPack pick your specific files before the one
shipped with CMake.

You may even only modify the CMAKE_MODULE_PATH when packaging
for NSIS if you use a CPACK_PROJECT_CONFIG_FILE
http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29

CPACK_EXTRA_INSTALL_COMMAND should be usable too but it depends
on the amount of code you have to put in it, I did have some trouble when trying
to put too much in this (but it was a long time ago so this limit may
now be gone).
Using CPACK_EXTRA_INSTALL_COMMAND implies  that you must  handle
escape sequences yourself
because the var evaluation process.

> I'm using cmake 2.8.0 (but can upgrade it if needed) and this should be
> valid for any Windows platform.

2.8.0 and up should be Ok but if you have a the choice I suggest you sue 2.8.3
or even try current 2.8.4-rc1 in order to propose up to date patch (if you do).

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list