[CMake] OBJECT libraries getting fully support?

Michael Ellery mellery451 at gmail.com
Tue Feb 12 19:19:48 EST 2019


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 <paul at mad-scientist.net> 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



More information about the CMake mailing list