Brad King wrote:

> On 07/29/2013 06:57 PM, Stephen Kelly wrote:
>> Yes, $<CONFIGURATION> should work both before and after export.
> 
> So the question is how to know whether to evaluate it during
> export or write it literally in the file.  In this case we want
> to expand it during export because we want $<CONFIGURATION> to
> refer to the build configuration being installed.

Right. I had thought that $<CONFIGURATION> would be evaluated by the reader 
of the IMPORTED_LOCATION property on the IMPORTED target.

I think you are right that it makes more sense to replace it at generate-
time.

>> The $<INSTALL_PREFIX> works in the INCLUDES DESTINATION because it is
>> replaced by preprocessing during export.
> 
> Does anything else get replaced by preprocessing?

Target names get replaced by namespaced target names, and the 
INSTALL_INTERFACE or BUILD_INTERFACE gets stripped.

>> For $<CONFIGURATION> it should be fine, but probably also involves
>> replacing (IMPORTED_)?LOCATION(_<CONFIG>)? with a genex-capable LOCATION.
> 
> The history of the LOCATION property is complicated enough already.
> If we do add genex support we should create a new name to
> distinguish it.
> 
> However, why would allowing $<CONFIGURATION> in the destination
> require a genex location?  We generate an install rule for a
> given configuration with $<CONFIGURATION> replaced and then
> put the corresponding result in IMPORTED_LOCATION_<CONFIG>.

Yes, that makes more sense.

So, the remaining question is when to evaluate the generator expressions. I 
agree that evaluating them at export time is a better idea. That means that 
I should patch the INCLUDES DESTINATION feature to do a complete evaluation, 
not just a preprocessing. I think that makes sense for all DESTINATION 
components.

So,

 install(TARGETS foo INCLUDES DESTINATION include/$<TARGET_PROPERTY:NAME>)

will result in 

 "include/foo"

in the INTERFACE_INCLUDE_DIRECTORIES of the IMPORTED target. However, 

 set_property(TARGET foo APPEND PROPERTY 
   INTERFACE_INCLUDE_DIRECTORIES
   include/$<TARGET_PROPERTY:NAME>
 )

will result in
 
 "include/$<TARGET_PROPERTY:NAME>"

in the INTERFACE_INCLUDE_DIRECTORIES of the IMPORTED target.

That is, parameters to install(TARGETS) are evaluated at export time, and 
otherwise the contents of the property are reproduced verbatim.

Thanks,

Steve.


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to