[cmake-developers] Requesting Advice: Installing object files

Ben Boeckel ben.boeckel at kitware.com
Wed Jan 18 15:14:07 EST 2017


On Wed, Jan 18, 2017 at 11:47:42 -0800, Chris Bieneman wrote:
> On Jan 18, 2017, at 5:58 AM, Ben Boeckel <ben.boeckel at kitware.com> wrote:
> > Plus our plan for installing OBJECT libraries was to install them as
> > INTERFACE libraries, leaving the objects themselves behind. The idea is
> > to allow object libraries into target_link_libraries() for usage
> > requirements and to support exporting them as part of the build system
> > (an explicit $<TARGET_OBJECTS> would still be required to use their
> > objects due to issues with transitive linking causing duplicate symbols
> > if target_sources were used).
> 
> Ah... that wouldn't work for us because we actually need the objects
> to be installed in the final product.

So I talked with Rob about this a bit and the INTERFACE bit is actually
the *exporting* of the target. Installing the target can install the
objects. I think the way this could work is that if it is installed, the
objects go and if they are exported, they are exported as an INTERFACE
library which supports a $<TARGET_OBJECTS> genex (and if the target is
not installed, it wouldn't work).

There will need to be some thought on it since there isn't a "just
export the target" mechanism yet. Off the top of my head, I'd like to
see install() have a INSTALL_OBJECTS keyword to cause OBJECT libraries
to put their objects anywhere (since I suspect it will be an uncommon
use case versus the need for a way to export the targets to an install
tree).

--Ben


More information about the cmake-developers mailing list