Joining an OBJECT and a SHARED library

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Joining an OBJECT and a SHARED library

George PF
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
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Joining an OBJECT and a SHARED library

Robert Maynard
I believe what you are looking for in the CMake 3.12 improvements to
object libraries. In 3.12  the target_link_libraries command now
supports linking to an object library to embed the object files ( only
on direct dependencies, no propagation of .objs ) and also propagates
usage requirements like any other library.


On Wed, Sep 5, 2018 at 12:27 PM George PF <[hidden email]> wrote:

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