[CMake] Use of ADD_CUSTOM_COMMAND

Gib Bogle g.bogle at auckland.ac.nz
Wed Apr 20 17:12:21 EDT 2011


Quoting Michael Hertling <mhertling at online.de>:

> On 04/20/2011 05:40 AM, Fraser Hutchison wrote:
>> Hi Gib,
>>
>> Try the following:
>>
>> GET_TARGET_PROPERTY(FUBAR_EXE fubar LOCATION)
>> ADD_CUSTOM_COMMAND(TARGET fubar POST_BUILD COMMAND ${CMAKE_COMMAND} -E
>> copy ${FUBAR_EXE} somepath)
>>
>> Cheers,
>>
>> Fraser.
>
> Don't use the obsolete LOCATION property since it might have subtle
> side effects, see [1]. Instead, use the new "generator expressions"
>
> ADD_CUSTOM_COMMAND(TARGET fubar POST_BUILD
>     COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:fubar> somepath)
>
> or follow the advice Michael W. has provided in the meantime.
>
> Regards,
>
> Michael H.

OK, I'll take your word for it :-).  One line is better than two, anyway.

Thanks
Gib

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the CMake mailing list