On 04/11/2018 10:48 AM, Gößwein Matthias / eeas gmbh wrote:
> CMake Error: The inter-target dependency graph contains the following
> strongly connected component (cycle):
>   "lib1" of type OBJECT_LIBRARY
>     depends on "lib2" (strong)
>   "lib2" of type OBJECT_LIBRARY
>     depends on "lib1" (weak)
> At least one of these targets is not a STATIC_LIBRARY.  Cyclic
> dependencies are allowed only among static libraries.
> 
> add_library(lib1 OBJECT lib1.c)
> target_link_libraries(lib1 PUBLIC lib2)
> add_library(lib2 OBJECT lib2.c)
> target_link_libraries(lib2 PUBLIC lib1)
> 
> Is it possible to implement the same thing for object libraries too

For reference, the documentation of tll behavior for object libraries is here:

  
https://cmake.org/cmake/help/git-master/command/target_link_libraries.html#linking-object-libraries

It states that "linking" object libraries to each other only propagates
usage requirements and does nothing special with the object files.
If there are dependencies like this then consumers would need to list
both object libraries together.  All object files would be listed once
on the link line and no repetition would be needed since explicitly
listing them guarantees they are linked.

Likely this will be okay.  However, I'd like to avoid supporting the
case until we gain more experience with the current design.  I've opened
an issue to track it here:

* OBJECT library circular target_link_libraries
  https://gitlab.kitware.com/cmake/cmake/issues/17905

Thanks,
-Brad
-- 

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-developers

Reply via email to