diff options
author | Brad King <brad.king@kitware.com> | 2015-03-27 20:25:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-03-27 20:25:09 (GMT) |
commit | ac14cbf01710c08e9bf31670cf40d88512b55752 (patch) | |
tree | d6df138d63017c30c18b9b244d79d5f926bff120 /Tests/InterfaceLibrary/headerdir | |
parent | 817d31db9797bfc1c6ff7e60e420532362b14463 (diff) | |
download | CMake-ac14cbf01710c08e9bf31670cf40d88512b55752.zip CMake-ac14cbf01710c08e9bf31670cf40d88512b55752.tar.gz CMake-ac14cbf01710c08e9bf31670cf40d88512b55752.tar.bz2 |
Allow add_dependencies() on INTERFACE libraries (#15414)
Revert commit v3.0.0-rc1~175^2~20 (add_dependencies: Disallow use with
INTERFACE_LIBRARY, 2013-12-25). Teach our dependency analysis to
transitively follow INTERFACE target utility dependencies as was done or
IMPORTED targets in commit v2.8.6~127^2~1 (Allow add_dependencies() on
imported targets, 2010-11-19). Extend the InterfaceLibrary test with a
case to cover header generation for a header-only INTERFACE library via
a custom target.
Diffstat (limited to 'Tests/InterfaceLibrary/headerdir')
-rw-r--r-- | Tests/InterfaceLibrary/headerdir/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in | 1 |
2 files changed, 9 insertions, 3 deletions
diff --git a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt index 98f521e..826a9ed 100644 --- a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt +++ b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt @@ -3,6 +3,11 @@ set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) add_library(headeriface INTERFACE) -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/iface_header_builddir.h" - "#define IFACE_HEADER_BUILDDIR\n" -) +add_custom_target(headeriface_gen + COMMENT "Generating iface_header_builddir.h" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/iface_header_builddir.h.in + ${CMAKE_CURRENT_BINARY_DIR}/iface_header_builddir.h + VERBATIM + ) +add_dependencies(headeriface headeriface_gen) diff --git a/Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in b/Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in new file mode 100644 index 0000000..42dd6df --- /dev/null +++ b/Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in @@ -0,0 +1 @@ +#define IFACE_HEADER_BUILDDIR |