Commit Graph

7 Commits

Author SHA1 Message Date
Brad King 2341470673 Merge topic 'tll-IMPORTED-targets'
9cfe4f1 Allow target_link_libraries with IMPORTED targets.
2013-01-10 10:22:26 -05:00
Brad King a9f1bf4380 Merge topic 'LINK_LIBRARIES-property'
7653862 Add LINK_LIBRARIES property for direct target link dependencies
40cf3fb Make linking APIs aware of 'head' target
2013-01-08 14:32:41 -05:00
Stephen Kelly 9ce1b9ef29 Add CMAKE_BUILD_INTERFACE_INCLUDES build-variable.
This makes

 set(CMAKE_BUILD_INTERFACE_INCLUDES ON)

add the equivalent of

 set_property(TARGET tgt APPEND PROPERTY
   INTERFACE_INCLUDE_DIRECTORIES
   $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}>
 )

to every target.

If the headers are in CMAKE_CURRENT_SOURCE_DIR, and the generated headers
are in CMAKE_CURRENT_BINARY_DIR, this is a convenient way to build a target
bar, which depends on foo, just by using target_link_libraries() and adding
the INTERFACE_INCLUDE_DIRECTORIES to the INCLUDE_DIRECTORIES of the target
being linked. There will be more-convenient porcelain API to consume the
property in the future.
2013-01-08 14:14:27 -05:00
Stephen Kelly 9cfe4f1b76 Allow target_link_libraries with IMPORTED targets.
This makes it possible to use:

 target_link_libraries(foo LINK_INTERFACE_LIBRARIES bar)

where foo is an IMPORTED target. Other tll() signatures are not
allowed.
2013-01-08 18:58:18 +01:00
Stephen Kelly 7653862798 Add LINK_LIBRARIES property for direct target link dependencies
Previously we kept direct link dependencies in OriginalLinkLibraries.
The property exposes the information in the CMake language through the
get/set_property commands.  We preserve the OriginalLinkLibraries value
internally to support old APIs like that for CMP0003's OLD behavior, but
the property is now authoritative.  This follows up from commit d5cf644a
(Split link information processing into two steps, 2012-11-01).

This will be used later to populate the link interface properties when
exporting targets, and will later allow use of generator expressions
when linking to libraries with target_link_libraries.

Also make targets depend on the (config-specific) union of dependencies.
CMake now allows linking to dependencies or not depending on the config.
However, generated build systems are not all capable of processing
config-specific dependencies, so the targets depend on the union of
dependencies for all configs.
2013-01-08 09:02:43 -05:00
Stephen Kelly 3096202932 Make targets depend on the link interface of their dependees. 2013-01-03 13:31:50 -05:00
Stephen Kelly 914382224d target_link_libraries: Add LINK_(PUBLIC|PRIVATE) options
Makes it possible to specify the link dependencies and link
interfaces in one command without repetition.
2011-11-22 16:52:35 -05:00