[CMake] rename of target on install

Michael Wild themiwi at gmail.com
Fri Mar 26 04:44:25 EDT 2010


On 26. Mar, 2010, at 9:23 , Micha Renner wrote:

> Am Freitag, den 26.03.2010, 08:33 +0100 schrieb Michael Wild:
>> On 25. Mar, 2010, at 23:41 , Hai Nguyen wrote:
>> 
>>> Hi all,
>>> 
>>> Is there a way for me to rename the executable during the install? I'm using
>>> the same CMakeList.txt to build several versions and I'd like to install
>>> them to different directories but with the version number stripped off of
>>> the executable.
>>> 
>>> Thanks,
>>> - Hai
>> 
>> I don't think there is a way of doing that. But what you can do is setting the OUTPUT_NAME and RUNTIME_OUTPUT_DIRECTORY target properties using the SET_TARGET_PROPERTIES command. This way, you can already reproduce the executable names and directory structure in the build tree.
>> 
> Maybe one can use "The PROGRAMS signature" of install
> 
> install(PROGRAMS files... DESTINATION <dir>
>          [PERMISSIONS permissions...]
>          [CONFIGURATIONS [Debug|Release|...]]
>          [COMPONENT <component>]
>          [RENAME <name>] [OPTIONAL])
> See:
> www.cmake.org/cmake/help/cmake-2-8-docs.html#command:install
> 
> Micha

This is possible using the LOCATION target property. But I think the other approach is cleaner and less confusing.

Michael



More information about the CMake mailing list