Hey all,

i've been wondering why CMake (3.3.+) yells at me if i want to add link libraries to an OBJECT target.
Consider the scenario

find_package(package_with_bar_target)

add_library(foo OBJECT ${foo_src})

# Would like to write

# target_link_libraries(foo bar)

# But have to use

target_include_directories(foo PRIVATE 
$<TARGET_PROPERTY:bar,INTERFACE_INCLUDE_DIRECTORIES>)


I know that intuitively "link library" is something different than "include directory". but one of the nice things of cmake is that it automatically sorts out everything for you when you specify link libraries. if there are more bar-dependent properties that need to be set in order to successfully compile foo (e.g. compile flags), i have to literally re-write all the nice internal cmake logic to establish the compile environment of bar for foo.

what's the plan with that? or are there any other (less involved) solutions? i need the objects of foo inside a larger target and want to avoid having a separate library being build that needs extra linking.

cheers!

--
Dr. Daniel Wirtz
Dipl. Math. Dipl. Inf.
SRC SimTech
Pfaffenwaldring 5a
+49 711 685 60044

--

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

Reply via email to