MantisBT - CMake
View Issue Details
0006103CMakeCMakepublic2007-11-30 16:382010-12-14 18:49
Baron Roberts 
David Cole 
normalfeatureN/A
closedno change required 
 
 
0006103: ADD_CUSTOM_TARGET and/or INSTALL needs a POST_INSTALL attribute
There are commands that need to be run after an INSTALL (e.g. stripping binaries). Currently this can only be accomplished using the INSTALL(CODE... or INSTALL(SCRIPT... commands. While this can be made to work, it is very clumsy and arcane because the DESTDIR environment variable needs to be taken into account. To perform a simple stripping of an installed executable one needs to write something like:

install(CODE "EXECUTE_PROCESS(COMMAND ${ARM-STRIP} --strip-all \$ENV{DESTDIR}${INSTALL_PREFIX}/bin/${target})")

At first the POST_BUILD attribute on ADD_CUSTOM_TARGET looks promising but it is not run after an install relink. So the best solution would be to provide either a POST_INSTALL attribute on ADD_CUSTOM_TARGET and/or on INSTALL. In addition, it would be very helpful to have a variable that reflects the true installation directory (i.e. with DESTDIR factored in).
No tags attached.
Issue History
2007-11-30 16:38Baron RobertsNew Issue
2007-12-14 20:34Bill HoffmanStatusnew => assigned
2007-12-14 20:34Bill HoffmanAssigned To => David Cole
2009-12-28 15:44David ColeNote Added: 0019002
2009-12-28 15:44David ColeStatusassigned => resolved
2009-12-28 15:44David ColeResolutionopen => no change required
2010-12-14 18:49David ColeNote Added: 0024050
2010-12-14 18:49David ColeStatusresolved => closed

Notes
(0019002)
David Cole   
2009-12-28 15:44   
The install(CODE or install(SCRIPT commands are the correct way to achieve this goal.

The recommended "POST_INSTALL attribute" would have the same code as an install(CODE or install(SCRIPT command, so how would it be any less clumsy or arcane?
(0024050)
David Cole   
2010-12-14 18:49   
Closing bugs that have been resolved for more than 3 months without any further updates.