[CMake] copy on install

Eric Noulard eric.noulard at gmail.com
Thu Feb 4 17:38:41 EST 2010


2010/2/4 Tim St. Clair <timothysc at gmail.com>:
> Is there a clean way to copy the install target e.g.
>
> install (TARGETS foo DESTINATION bin)
>
> ~ install(TARGETS foo DESTINATION loc2 RENAME foo_bar) <-doesn't exist.
>
> I basically need to install the same target to *multiple* locations
> with different names.

I think multiple location is already supported just call

install (TARGETS foo DESTINATION loc1)
install (TARGETS foo DESTINATION loc2)
install (TARGETS foo DESTINATION loc3)
etc...

now concerning renaming without building the same target several times?
May be with add_custom_command

add_custom_command(TARGET foo
                                   POST_BUILD
                                   COMMAND ${CMAKE_COMMAND} -E copy
foo ${CMAKE_BINARY_DIR}/foo_renamed)

+
install(FILES ${CMAKE_BINARY_DIR}/foo_renamed DESTINATION loc2)


this may not really solves the problem because install(FILES djfldfj)
won't make what install(TARGETS do like rpath handling etc....

a working (but ugly solution) would be to built the target as many
time as you need to with the needed different name each time.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list