cmake add_library at a custom location
Posted
by celil
on Stack Overflow
See other posts from Stack Overflow
or by celil
Published on 2010-05-11T20:16:27Z
Indexed on
2010/05/14
16:24 UTC
Read the original article
Hit count: 403
cmake
|add-libary
I need to build a library that is to be placed at a custom location stored in the variable CUSTOM_OUTDIR. Currently, I am using the following code to make sure that the library is copied to its proper location.
ADD_LIBRARY(example MODULE example.c)
GET_TARGET_PROPERTY(FILEPATH example LOCATION)
ADD_CUSTOM_COMMAND(
TARGET example POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${FILEPATH} ${CUSTOM_OUTDIR}
)
However, this is not a good solution as the copying is done post_build, and I end up with two copies of the library. Is there a way to setup CMAKE_BINARY_DIR just for the example
library so that only one copy of it is kept in the proper location?
© Stack Overflow or respective owner