OBJECT libraries getting fully support?

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

OBJECT libraries getting fully support?

Paul Smith
Hi all;

I saw an email to the list from Chuck Atkins in the summer of 2017
suggesting that OBJECT libraries were being enhanced and could become
fully-functional libraries hopefully sometime that year.  I'm wondering
if that ever actally happened and if so what release of cmake it was
in, and if not is there still a plan for this sometime?

I'm trying to convert a large and complex cmake environment originally
started in 2007 or so, which uses all old-school cmake facilities, to
use modern cmake methods.

I have a situation where we have a library containing basic methods
which can be implemented multiple ways and different executables use
different implementations.  However these methods are used by all sorts
of static libraries as well.

Since we don't know until executable link time which library to use,
the static libraries cannot depend on the base library: it has to be
listed only in the executable's target_link_libraries.  But of course
because the static libraries use them as well we need the base library
to be listed last (or near last) in the link line else we get undefined
symbols.  Adding the base library to the executable TLL doesn't allow
us to do that.

So I was thinking of making this base library an OBJECT library so it
would always be fully linked but it seems that our version of cmake
doesn't allow an OBJECT library to be used as a normal library and I'd
be reduced to adding lots of generator expressions for it everywhere
which is a huge PITA.

Any ideas on how best to address this situation, if OBJECT libraries
are not supported yet?

--

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: OBJECT libraries getting fully support?

Paul Smith
Don't want to be a noodge but wondering if anyone has any thoughts
about this question or ideas on how to solve my problem?


On Sat, 2019-02-09 at 12:29 -0500, Paul Smith wrote:

> Hi all;
>
> I saw an email to the list from Chuck Atkins in the summer of 2017
> suggesting that OBJECT libraries were being enhanced and could become
> fully-functional libraries hopefully sometime that year.  I'm wondering
> if that ever actally happened and if so what release of cmake it was
> in, and if not is there still a plan for this sometime?
>
> I'm trying to convert a large and complex cmake environment originally
> started in 2007 or so, which uses all old-school cmake facilities, to
> use modern cmake methods.
>
> I have a situation where we have a library containing basic methods
> which can be implemented multiple ways and different executables use
> different implementations.  However these methods are used by all sorts
> of static libraries as well.
>
> Since we don't know until executable link time which library to use,
> the static libraries cannot depend on the base library: it has to be
> listed only in the executable's target_link_libraries.  But of course
> because the static libraries use them as well we need the base library
> to be listed last (or near last) in the link line else we get undefined
> symbols.  Adding the base library to the executable TLL doesn't allow
> us to do that.
>
> So I was thinking of making this base library an OBJECT library so it
> would always be fully linked but it seems that our version of cmake
> doesn't allow an OBJECT library to be used as a normal library and I'd
> be reduced to adding lots of generator expressions for it everywhere
> which is a huge PITA.
>
> Any ideas on how best to address this situation, if OBJECT libraries
> are not supported yet?

--

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: OBJECT libraries getting fully support?

Michael Ellery
https://cmake.org/cmake/help/latest/release/3.12.html says that target_link_libraries got OBJECT in 3.12 - is that what you had in mind?

-Mike

> On Feb 12, 2019, at 3:35 PM, Paul Smith <[hidden email]> wrote:
>
> Don't want to be a noodge but wondering if anyone has any thoughts
> about this question or ideas on how to solve my problem?
>
>
> On Sat, 2019-02-09 at 12:29 -0500, Paul Smith wrote:
>> Hi all;
>>
>> I saw an email to the list from Chuck Atkins in the summer of 2017
>> suggesting that OBJECT libraries were being enhanced and could become
>> fully-functional libraries hopefully sometime that year.  I'm wondering
>> if that ever actally happened and if so what release of cmake it was
>> in, and if not is there still a plan for this sometime?
>>
>> I'm trying to convert a large and complex cmake environment originally
>> started in 2007 or so, which uses all old-school cmake facilities, to
>> use modern cmake methods.
>>
>> I have a situation where we have a library containing basic methods
>> which can be implemented multiple ways and different executables use
>> different implementations.  However these methods are used by all sorts
>> of static libraries as well.
>>
>> Since we don't know until executable link time which library to use,
>> the static libraries cannot depend on the base library: it has to be
>> listed only in the executable's target_link_libraries.  But of course
>> because the static libraries use them as well we need the base library
>> to be listed last (or near last) in the link line else we get undefined
>> symbols.  Adding the base library to the executable TLL doesn't allow
>> us to do that.
>>
>> So I was thinking of making this base library an OBJECT library so it
>> would always be fully linked but it seems that our version of cmake
>> doesn't allow an OBJECT library to be used as a normal library and I'd
>> be reduced to adding lots of generator expressions for it everywhere
>> which is a huge PITA.
>>
>> Any ideas on how best to address this situation, if OBJECT libraries
>> are not supported yet?
>
> --
>
> 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
Reply | Threaded
Open this post in threaded view
|

Re: OBJECT libraries getting fully support?

Paul Smith
On Tue, 2019-02-12 at 16:19 -0800, Michael Ellery wrote:
> https://cmake.org/cmake/help/latest/release/3.12.html
>  says that target_link_libraries got OBJECT in 3.12 - is that what
> you had in mind?

Aha!  Of course, we're using the most recent 3.11 version.  Isn't it
always the way it goes?

OK I'll test with a newer version of CMake and see if I can get things
to work.

It would be great if anyone knows of a way to force a library to be
listed "last" (or near the end anyway) of an executable link line
regardless of dependency information described by
target_link_libraries() (when using modern CMake methods).

If I could do that I could avoid needing the OBJECT library in the
first place and just use a STATIC library.

--

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