Hi,
I'd like to use target_link_libraries() on an OBJECT-library for the
following reason:
I'm creating an OBJECT-library which has quite some requirement
regarding include-dirs, compile-options and -definitions. Which is why
my CMakeLists.txt currently looks somehow like this: (runtime is an
interface-library)
add_library(runtime-main OBJECT runtime.cpp)
target_include_directories(runtime-main
PRIVATE
$<TARGET_PROPERTY:runtime,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_features(vsora-runtime-main
PRIVATE
$<TARGET_PROPERTY:runtime,INTERFACE_COMPILE_FEATURES>)
target_compile_options(vsora-runtime-main
PRIVATE
$<TARGET_PROPERTY:runtime,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(vsora-runtime-main
PRIVATE
$<TARGET_PROPERTY:runtime,INTERFACE_COMPILE_DEFINITIONS>)
I think the last 4 commands could be factored in a simple call to
target_link_libraries(runtime-main INTERFACE runtime)
(INTERFACE would have to be used even when the to be linked
library is not an INTERFACE library)
or
target_link_libraries(runtime-main PRIVATE runtime)
or
target_link_libraries(runtime-main OBJECT runtime)
I started looking into the code, except removing the check in
cmTargetLinkLibraries.cpp I didn't do much. And this does not make it
work.
Before continuing I'd like to know whether this is a good idea to work
on or if there are good arguments to never allow "linking" an
object-library to get compile information from other libraries?
best regards,
--
Patrick.
--
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:
http://public.kitware.com/mailman/listinfo/cmake-developers