[CMake] Multiple output directories

Michael Hertling mhertling at online.de
Tue Jun 28 12:09:25 EDT 2011


On 06/28/2011 12:36 PM, Michael Hertling wrote:
> On 06/28/2011 10:40 AM, pellegrini wrote:
>> Hello everybody,
>>
>> I would like to know if there is a cmake command to place my generated 
>> executable in several directories in one shot.
>>
>> Using SET(EXECUTABLE_OUTPUT_PATH    my_path1) will allow to customize 
>> the place where my executable should be placed
>> but only in a single directory I guess.
>>
>> Any idea ?
>>
>> thanks a lot
>>
>> Eric
> 
> You might use several
> 
> ADD_CUSTOM_COMMAND(TARGET myexe POST_BUILD
>     COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:myexe> mypath)
> 
> commands for this purpose.

Or just one with several COMMAND clauses:

ADD_CUSTOM_COMMAND(TARGET myexe POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:myexe> mypath1
    COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:myexe> mypath2
    COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:myexe> mypath3)

Regards,

Michael


More information about the CMake mailing list