> On Jan 18, 2017, at 5:58 AM, Ben Boeckel <ben.boec...@kitware.com> wrote:
> 
> On Wed, Jan 18, 2017 at 10:14:26 +0100, Nils Gladitz wrote:
>> On 17.01.2017 23:25, Chris Bieneman wrote:
>>> Hello CMake-developers!
>>> 
>>> In one of the LLVM sub-projects we have a problem where we need to 
>>> install object files, which doesn't seem like a particularly easy 
>>> task. I'm curious if anyone has any advice on how to approach this 
>>> problem.
>>> 
>>> The patch is currently being reviewed here:
>>> https://reviews.llvm.org/D28791
>>> 
>>> Since the object files have fairly simple compile commands our current 
>>> approach is to compile the files in custom commands, then use 
>>> install(FILES...). This is workable, but I'm wondering if there is a 
>>> better way. They do need to be object files, static archives would not 
>>> work because these specially named files are handled by linkers and 
>>> other tools that we don't control.
>> 
>> Also more of a workaround but perhaps you could create static libraries 
>> but extract them with e.g. CMAKE_AR (toolchain specific) during either 
>> installation e.g. install(CODE|SCRIPT) or as a POST_BUILD custom command.

We could consider this, but I'm not sure that this is really any simpler than 
what we're doing.

> 
> This issue might be the best way to go:
> 
>    https://gitlab.kitware.com/cmake/cmake/issues/15226 
> <https://gitlab.kitware.com/cmake/cmake/issues/15226>

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.

> 
>> An OBJECT library might be better suited in theory but I don't think it 
>> currently allows installation and the location of the object files is 
>> generator specific (and afair not always known to cmake).
>> By doing a manual extraction of the archive you'd be in control over 
>> where the objects go.
> 
> 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.

Thanks!
-Chris

> 
> --Ben

-- 

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:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to