With Public it is still the same problem :( cmake_minimum_required(VERSION 3.14) project(test_object_lib_nesting)
set(CMAKE_CXX_STANDARD 14) add_library(first_object_lib OBJECT first.cpp) add_library(second_object_lib OBJECT second.cpp) target_link_libraries(second_object_lib PUBLIC first_object_lib) add_executable(test_object_lib_nesting main.cpp) target_link_libraries(test_object_lib_nesting second_object_lib) /cmake -E cmake_link_script CMakeFiles/test_object_lib_nesting.dir/link.txt --verbose=1 /usr/bin/clang++-6.0 -g CMakeFiles/test_object_lib_nesting.dir/main.cpp.o CMakeFiles/second_object_lib.dir/second.cpp.o -o test_object_lib_nesting CMakeFiles/second_object_lib.dir/second.cpp.o: In function `Second::get_second()': /home/csita/CLionProjects/test_object_lib_nesting/second.cpp:10: undefined reference to `First::get_first() const' clang: error: linker command failed with exit code 1 (use -v to see invocation) I read the issue and it seems that there is no solution jet .... Is there an easy / not so easy workaround ? I have a dependency tree which can go down to 20 - 30 libs. (code generator ) also diamond graph. :(. Cheers Richard On Wed, 22 May 2019 at 14:25, Robert Maynard <robert.mayn...@kitware.com> wrote: > > This is a known limitation of the current design. Only directly linked > object library objects are propagated. > > For more details on why see: > https://gitlab.kitware.com/cmake/cmake/issues/18090 > > On Wed, May 22, 2019 at 1:48 AM Richard Szabo <sz.rich...@gmail.com> wrote: > > > > Hi cmakers > > > > I'm trying to get the following example working: > > ``` > > cmake_minimum_required(VERSION 3.14) > > project(test_object_lib_nesting) > > > > set(CMAKE_CXX_STANDARD 14) > > > > add_library(first_object_lib OBJECT first.cpp) > > > > add_library(second_object_lib OBJECT second.cpp) > > > > target_link_libraries(second_object_lib first_object_lib) > > > > add_executable(test_object_lib_nesting main.cpp) > > > > target_link_libraries(test_object_lib_nesting second_object_lib) > > ``` > > > > The problem I have that the linker command line will have only the > > second.cpp.o for linking the first.cpp.o will not be added as link > > object to the exe. Causing missing symbols on exe linkage. > > > > How to transitively resolve and link "nested" Object library targets ?. > > -- > > > > 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 -- 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