[CMake] transitive linkage of OBJECT library targets

2019-05-21 Thread Richard Szabo
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_l

Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread hex
Without cycling dependencies you can do something like this: /add_executable(test_object_lib_nesting main.cpp)// // //target_link_libraries(test_object_lib_nesting// //    second_object_lib// //    first_object_lib// //)/ The problem I have that the linker command line will have only the second

Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread Petr Kmoch
Hi Richard, does it help if you specify the linking as PUBLIC? I.e.: target_link_libraries(second_object_lib PUBLIC first_object_lib) Petr On Wed, 22 May 2019 at 07:48, Richard Szabo wrote: > Hi cmakers > > I'm trying to get the following example working: > ``` > cmake_minimum_required(VERSIO

Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread Robert Maynard via CMake
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 wrote: > > Hi cmakers > > I'm trying to get the following e

Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread Richard Szabo
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_obje

Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread Richard Szabo
The reason going to object libs instead of static libs is the limitation of windows dynamic libraries that export simbols must be in the liner command line object it can not be added to the static libraries linked to the dlls. with gcc this problem can be solved with -Wl,--whole-archive libs