[cmake-developers] [CMake] 2.8.11-rc3 generator expression error
Stephen Kelly
steveire at gmail.com
Sun Apr 28 06:49:29 EDT 2013
Brad King wrote:
> On Fri, Apr 26, 2013 at 10:39 AM, Stephen Kelly
> <steveire at gmail.com> wrote:
>> Brad King <brad.king at ...> writes:
>>
>>> I looked into implementing this and realized that we're not propagating
>>> usage requirements from the entire link closure, only from the direct
>>> dependencies.
>>
>> Are you sure? Maybe I don't understand what you mean. Can you post a code
>> snippet?
>>
>> add_library(foo SHARED empty.cpp)
>> target_include_directories(foo INTERFACE /opt/foo)
>> add_library(bar SHARED empty.cpp)
>> add_library(sho SHARED empty.cpp)
>>
>> target_link_libraries(sho bar)
>> target_link_libraries(bar foo)
>
> It appears to work but I do not see how from a quick read of the
> implementation.
> The AppendTllIncludes is only called for direct dependencies by tll().
> What propagates the requirement transitively in 2.8.11-rc3?
Ah, indeed. This solves the mystery of why the current implementation
creates the generator expression for each entry instead of reading the
property directly.
$<TARGET_PROPERTY:foo,INTERFACE_INCLUDE_DIRECTORIES>
gives a transitively evaluated result, but
fooTarget->GetDefinition("INTERFACE_INCLUDE_DIRECTORIES")
does not.
The former works because it is part of the targetPropertyTransitiveWhitelist
in cmGeneratorExpressionEvaluator when evaluating the TargetPropertyNode, so
I probably also wanted to ensure re-use of the logic around there for
context-sensitive conditions which relate to caching.
It can probably be refactored to bypass the genex evaluation though.
Thanks,
Steve.
More information about the cmake-developers
mailing list