[CMake] CPack/NSIS: start menu entry without cpack_package_executables

Daniel Franke franke.daniel at gmail.com
Sat Jul 16 20:58:22 EDT 2011


Hi all.

I try to build a NSIS package for a largish project with many components and a 
plethora of local and imported binaries. One of the last steps would be to add 
Start menu entries for the binaries of the selected components [*].

The problem I face: due to the size of the project, we abstracted away as much 
of the cmake/cpack details into macros as possible. This includes adding 
targets and defining components; as is, all aspects of a binary or component 
are handled in a single CMakeLists.txt and besides dependencies, no knowledge 
of other elements is shared between CMakeLists.txt files. These macros, as 
they define targets, are being called after CPack was included. However, to 
get start menu entries, it seems that all potential start menu elements in 
CPACK_PACKAGE_EXECUTABLES must be defined _before_ CPack is included. In my 
case, on inclusion of CPack, I don't know yet which target will be added or 
imported later due to system setup, how could I possibly provide a list?

Questions:
 (a) Is it possible to update CPACK_PACKAGE_EXECUTABLES after inclusion 
     of CPack? A naive addition like
       list (APPEND CPACK_PACKAGE_EXECUTABLES mytarget "Target Description")
     after definition of "mytarget" seems to be ignored?!
 (b) Is there an alternative way to dynamically add start menu entries for
     targets (each target knows if it wants a menu entry, but no central
     place shall know all targets)? 

If possible, I'd like to avoid CPACK_NSIS_EXTRA_INSTALL_COMMANDs to create 
shortcuts and I'd especially like to avoid to write my own NSIS script 
template ... 

Any pointers would be highly welcome!

Thanks

	Daniel


P.S. On my machine it takes 20 minutes to repackage the project, testing even 
the simplest changes is not fun :(

[*] http://www.cmake.org/Bug/view.php?id=9846 - Meh!


More information about the CMake mailing list