Brad King wrote:

> On 11/07/2012 08:30 AM, Stephen Kelly wrote:
>> The upstream will generate different properties which contain duplicate
>> information. Lets say this is generated:
> 
> I think this example would be easier to understand if you write out:
> 
> (1) What the upstream CMakeLists.txt file contains
> (2) What the export files contain
> (3) What the application contains
> 
> Right now I only care about cases where the projects have not been
> modified and use only the old interfaces, but tll() enables the new
> interfaces.

Ok. 

1) 

Upstream contains:

 add_library(foo SHARED ${foo_SRCS})
 target_link_libraries(foo LINK_PRIVATE bar)
 target_link_libraries(foo LINK_PUBLIC bang floom)
 set_property(TARGET foo APPEND PROPERTY 
     LINK_INTERFACE_LIBRARIES_DEBUG yip)

 install(TARGETS foo EXPORT fooTargets

 install(EXPORT fooTargets NAMESPACE NS:: FILE FooTargets.cmake)

2) 

The generated FooTargets.cmake contains (2.8.10):

 ADD_LIBRARY(NS::foo SHARED IMPORTED)

and the generated FooTargets-debug.cmake contains (2.8.10):

 SET_PROPERTY(TARGET NS::foo APPEND 
     PROPERTY IMPORTED_CONFIGURATIONS DEBUG)

SET_TARGET_PROPERTIES(NS::foo PROPERTIES
  IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG "bang;floom;yip"
  IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/libfoo.so.0.2.0"
  IMPORTED_SONAME_DEBUG "libfoo.so.0"
  )

If built with 2.8.11 FooTargets.cmake contains:

 ADD_LIBRARY(NS::foo SHARED IMPORTED)
 
 SET_TARGET_PROPERTIES(NS::foo PROPERTIES
   INTERFACE_LINK_LIBRARIES "bang;floom"
 )

and the generated FooTargets-debug.cmake contains (2.8.11):

 SET_PROPERTY(TARGET NS::foo APPEND 
     PROPERTY IMPORTED_CONFIGURATIONS DEBUG)

 SET_TARGET_PROPERTIES(NS::foo PROPERTIES
  IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG "bang;floom;yip"
  IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/libfoo.so.0.2.0"
  IMPORTED_SONAME_DEBUG "libfoo.so.0"
  )

... That is, identical to the 2.8.10 version. 

Additionally, the order of the elements in INTERFACE_LINK_LIBRARIES is the 
same as the order in IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG (as added by 
tll()) **.

3)

Downstream contains this:

 find_package(Foo)
 
 add_library(Consumer SHARED ${Consumer_SRCS})
 target_link_libraries(Consumer NS::foo)

If downstream uses 2.8.10, the effect is the 
IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG property is read as before.

If downstream uses 2.8.11, the effect is the INTERFACE_LINK_LIBRARIES is 
first read (result: 'bang;floom'), then the 
IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG property is read as before. It 
contains 'bang;floom;yip', the first two of which are already in the result, 
so are not re-added. The 'yip' entry is added though. The order is also the 
same because of ** above.



However, I can see that if upstream instead did this:

 set_property(TARGET foo APPEND PROPERTY 
     LINK_INTERFACE_LIBRARIES_DEBUG yip)
 target_link_libraries(foo LINK_PUBLIC bang floom)

Then 2.8.10 would result in 'yip;bang;floom', but 2.8.11 would result in 
'bang;floom;yip'. I guess that's the case you're interested in. 

Maybe we can fix that with some property aliasing tricks (ie, make the 'old' 
properties able to process generator expressions, and make reading 
INTERFACE_LINK_LIBRARIES actually read the LINK_INTERFACE_LIBARARIES(_*)?, 
but I haven't thought it through yet).

> Note that the old-style per-config interface completely overrides
> the configless form in current behavior:

Ah, right. My branch knows that but I forgot it.

> 
>  
http://www.cmake.org/cmake/help/v2.8.10/cmake.html#prop_tgt:LINK_INTERFACE_LIBRARIES_CONFIG
>  "this property completely overrides the generic property for the named
>  configuration"
> 
> If INTERFACE_LINK_LIBRARIES is set with a generator expression to handle
> the debug case (constructed by tll), and LINK_INTERFACE_LIBRARIES_DEBUG
> is set, then which one should 2.8.11 use in the consumer?
> 

In my topic it uses the result of processing INTERFACE_LINK_LIBRARIES, then 
whatever is in LINK_INTERFACE_LIBRARIES_DEBUG but not in the result yet.

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