Hi,
I have 4 configurations (2 for Debug and 2 for Release) and I would like to
install the libraries such that they are installed in the correct
directories.
Installing without worrying about configurations looks like this:
install(TARGETS ${LIB_NAME}
EXPORT ${LIB_NAME}Config
PUBLIC_HEADER DESTINATION "include/${LIB_NAME}"
LIBRARY DESTINATION "bin/${LIB_NAME}/"
ARCHIVE DESTINATION "lib/${LIB_NAME}/"
)
However, different configurations overwrite the binaries. So instead, I did
something like this (I'm going over all my configurations in a foreach):
install(TARGETS ${LIB_NAME}
CONFIGURATIONS DEBUG
EXPORT ${LIB_NAME}Config
PUBLIC_HEADER DESTINATION "include/${LIB_NAME}"
LIBRARY DESTINATION "bin/${LIB_NAME}/debug/"
ARCHIVE DESTINATION "lib/${LIB_NAME}/debug"
)
install(TARGETS ${LIB_NAME}
CONFIGURATIONS RELEASE
EXPORT ${LIB_NAME}Config
PUBLIC_HEADER DESTINATION "include/${LIB_NAME}"
LIBRARY DESTINATION "bin/${LIB_NAME}/release/"
ARCHIVE DESTINATION "lib/${LIB_NAME}/release/"
)
however, that results in the error:
CMake Error: INSTALL(EXPORT ...) includes target "MyLibrary" more than once
in the export set.
The error makes sense, in that I cannot have multiple exports in the same
export set, in this case ${LIB_NAME}Config. However, I would like CMake to
choose a different directory based on the configuration.
Now there is a workaround... sort of. I could name the binaries based on
the configuration but that doesn't work with our existing build systems. We
want the following:
lib/${LIB_NAME}/${CONFIG}/libname
Any way to get CMake to install the libraries this way?
Thank you,
Saad
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake