[CMake] Install interface
Quaquaraquà
nuquaquaraqua at gmail.com
Sat Aug 4 07:12:49 EDT 2018
Good morning,
given the following configuration:
/CMakeLists.txt
/include/
/lib1/CMakeLists.txt
/lib2/CMakeLists.txt
...
where each /lib.*/CMakeLists.txt creates its own archive:
add_library(lib.* EXCLUDE_FROM_ALL
foo.cpp
bar.cpp
)
target_link_libraries(lib1 PUBLIC interface)
and the final /CMakeLists.txt should wrap all libraries together::
add_library(interface INTERFACE)
target_include_directories(interface INTERFACE include/)
add_subdirectory(lib1 lib2...)
add_library(libcommon INTERFACE)
target_link_libraries(libcommon INTERFACE lib1 lib2...)
I wonder how to create an install target for the final library `libcommon' ?
This snippet doesn't seem effective with INTERFACE targets:
install(TARGETS libcommon
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
Thanks,
Quack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180804/1938e154/attachment.html>
More information about the CMake
mailing list