OBJECT Libraries and linking against targets

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

OBJECT Libraries and linking against targets

Wesley Smith
I understand vaguely why OBJECT libraries can't link against other targets, but I don't think the restriction in place needs to be so constrained.  Consider the following:

* A target is being create as an OBJECT library
* A number of other targets are defined as INTERFACE target where they only set include paths, compiler options, etc.

How is it possible to communicate the dependencies expressed in an INTERFACE target to an OBJECT library?  So far the only method I've found that works is to use a handful of generator expressions, which seems like a lot of work for something that would just work if I could "link" the INTERFACE library against the OBJECT library.

Here's what I have to do:

target_compile_features(tgt PUBLIC
target_include_directories(tgt PUBLIC
target_compile_options(tgt PUBLIC
target_compile_definitions(tgt PUBLIC



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: