[cmake-developers] [CMake 0014317]: Configuration dependent install EXPORT

Stephen Kelly steveire at gmail.com
Mon Jul 29 18:57:52 EDT 2013


Brad King wrote:

> Steve,
> 
> On 07/26/2013 04:43 AM, Mantis Bug Tracker wrote:
>> http://www.cmake.org/Bug/view.php?id=14317
> 
> What do you think about adding generator expressions to install
> DESTINATION options.  In particular the $<CONFIGURATION> genex
> would be useful in this case.

Yes, $<CONFIGURATION> should work both before and after export.

One of my goals with the INCLUDES DESTINATION feature which can not 
currently be realized is this:

 install(TARGETS foo bar bat
   EXPORT theTargets 
   ...
   INCLUDES DESTINATION include/$<TARGET_PROPERTY:NAME>
 )
 install(EXPORT theTargets NAMESPACE TP1:: )
 install(FILES foo.h DESTINATION include/foo)
 install(FILES bar.h DESTINATION include/bar)
 install(FILES bat.h DESTINATION include/bat)

The problem (apart from NAME not being currently a target property) is that 
the $<TARGET_PROPERTY:NAME> is reproduced verbatim in 
theTargetsExport.cmake. There the target names are TP1::foo etc, and 
include/TP1::foo does not exist.

The $<INSTALL_PREFIX> works in the INCLUDES DESTINATION because it is 
replaced by preprocessing during export. 

A new $<TARGET_NAME_PP> could be introduced to make the above possible by 
being replaced during preprocessing too, or a target property could be 
populated like TARGET_BUILD_NAME. I didn't like the idea of leaking build-
details to export files, and the TARGET_NAME_PP is not super elegant either, 
so I left the above as out of scope for now.

However, similar issues could arise by adding genexes to any DESTINATION 
component of install, if a generator expression reads a property from a 
target, and that property is not exported.

That's probably something that can be just documented though. For 
$<CONFIGURATION> it should be fine, but probably also involves replacing 
(IMPORTED_)?LOCATION(_<CONFIG>)? with a genex-capable LOCATION.

Thanks,

Steve.





More information about the cmake-developers mailing list