[CMake] Windows: install conditionnaly an executable

Eric Noulard eric.noulard at gmail.com
Mon Sep 19 10:30:50 EDT 2011


Please do not drop the ML address.


2011/9/19  <ycollette.nospam at free.fr>:
>>>
>>> How can I read with cmake the registry key "dynamically" in the installer and use this version number to install conditionnaly some applications ?
>>
>>You need to have a look at your specific installer language (seems to be NSIS) in order to embbed such script
>>in your installer (with some extra commands in "CPACK_NSIS_EXTRA_INSTALL_COMMANDS")
>
> So I need to get rid of al the install commands in my CMakeFiles.txt and replace them by NSIS commands embedded in the CPACK_NSIS_EXTRA_INSTALL_COMMANDS ?

I don't really know NSIS enough to be sure but may be you can:

 1) Use CMake install command as usual may be some extra COMPONENT
argument in order to create logical groups
     http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack

 2) Use NSIS scripting in order to "enable/disable" component
installation depending on the thing
     the installer found on the machine.

You cannot use CMake (nor CPack) to decide what to install or not to
install on the target machine because
I suppose you build the NSIS installer on one machine and then install
on another one right?

So I think you must put into your NSIS installer all the files, and
then decide with some
installer specific mean what to effectively install or not.

This not much of a CMake/CPack problem but more an NSIS problem.

Currently there is no cross-platform/cross-installer "install time" action which
can be implemented using CMake/CPack.

install(CODE
or
install(SCRIPT

may be the beginning of such a feature but this is not enough and would
require CMake to be present at install time which is not the case today.


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


More information about the CMake mailing list