[cmake-developers] CMake 2.8.12 transitive link regression?

Brad King brad.king at kitware.com
Fri Nov 1 09:04:13 EDT 2013


On 11/01/2013 08:49 AM, Brad King wrote:
> On 11/01/2013 07:32 AM, Stephen Kelly wrote:
>>  add_library(foo SHARED foo.cpp)
>>  add_library(bar SHARED foo.cpp)
>>  # target_link_libraries(foo bar)
>>  set_property(TARGET foo PROPERTY LINK_LIBRARIES bar)
>>  file(GENERATE OUTPUT outputfile 
>>    CONTENT "$<TARGET_PROPERTY:foo,INTERFACE_LINK_LIBRARIES>\n")
>>  # Expect outputfile to contain 'bar', but it does not.

Actually, why would we expect 'bar' when setting LINK_LIBRARIES
directly?  Without the old plain tll() calls I see no reason to
expect the link interface to be the link implementation.

The link implementation fallback is only for compatibility with
the long-standing tll plain signature behavior.  If a project
sets link information by other means then it takes responsibility
for setting the link interface too.

> Perhaps the implementation of cmTarget::GetProperty can
> special-case INTERFACE_LINK_LIBRARIES to return LINK_LIBRARIES
> if only the plain tll signature was used.

On second thought, this is a bad idea because it could trigger
in a get_property call or something earlier than the last tll
call.

So yes, hacking the generator expression node for the fallback
is probably the right fix.

Please also work on the test cases.

Thanks,
-Brad



More information about the cmake-developers mailing list