[cmake-developers] Requesting Advice: Installing object files

Brad King brad.king at kitware.com
Wed Apr 26 16:31:34 EDT 2017


On 01/18/2017 03:14 PM, Ben Boeckel wrote:
> Installing the target can install the objects.
[snip]
On 01/18/2017 02:47 PM, Chris Bieneman wrote:
> If this allowed TARGET_OBJECTS to be used in the install(FILES ...)
> command, then we could create an object library and a custom install
> rule for the objects, which would be a lot cleaner.

In CMake `master` we now support `$<TARGET_OBJECTS:...>` in
`install(FILES)` and also support installing object libraries
directly via `install(TARGETS)` with an `OBJECTS DESTINATION`.

This will be in CMake 3.9.  Please try it out.

One problem for your use case is that the object file names
are still controlled by the generator.  You may need a custom
step with `install(SCRIPT)` or `install(CODE)` to fix the names
after installation.

-Brad


More information about the cmake-developers mailing list