[CMake] Joining an OBJECT and a SHARED library

George PF george.p.f at mail.com
Wed Sep 5 12:27:21 EDT 2018


Hi,

is there a way to "join" an the OBJECT library with a SHARED library it creates?

The abclib and its component abc_tmp, all .c file have #include "foo.h":

    add_library(abc_tmp OBJECT z1. z2.c) 
    # generate...
    add_library(abclib SHARED $<TARGET_OBJECTS:abc_tmp> generated.c)

Then adding the library foo, which adds the include path to "foo.h" - but this only
works for 'generated.c', the include path for z1/z1 is not extended:

    target_link_libraries(abclib PUBLIC foo)

Repeating the same for 'abc_tmp' is really cumbersome, I want to this to apply to everything
which goes into creating the abclib, directly or indirectly, is that possible?


Regards

GPF


More information about the CMake mailing list