diff options
author | Brad King <brad.king@kitware.com> | 2024-04-22 18:48:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-04-29 21:40:03 (GMT) |
commit | 8d1d6a1437f8bce3c771f93cdafbffcfc7d6173a (patch) | |
tree | 4e2a7bf8650da93a679fd03e6c8552475930fc84 /Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink.cmake | |
parent | abf607c2ec8e0260ce6e453a047d75bcbecf91e7 (diff) | |
download | CMake-8d1d6a1437f8bce3c771f93cdafbffcfc7d6173a.zip CMake-8d1d6a1437f8bce3c771f93cdafbffcfc7d6173a.tar.gz CMake-8d1d6a1437f8bce3c771f93cdafbffcfc7d6173a.tar.bz2 |
Tests: Cover TARGET_PROPERTY genex evaluation of transitive link properties
Demonstrate that TARGET_PROPERTY does not honor CMP0099 from CMake 3.17.
Diffstat (limited to 'Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink.cmake')
-rw-r--r-- | Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink.cmake | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink.cmake new file mode 100644 index 0000000..c120366 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink.cmake @@ -0,0 +1,42 @@ +enable_language(C) + +add_library(foo1 STATIC empty.c) +target_link_libraries(foo1 PRIVATE foo2 foo3) +target_link_directories(foo1 INTERFACE dir1) +target_link_options(foo1 INTERFACE -opt1) +set_target_properties(foo1 PROPERTIES + INTERFACE_LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/dep1" + ) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dep1" "") + +add_library(foo2 STATIC empty.c) +target_link_directories(foo2 INTERFACE dir2) +target_link_options(foo2 INTERFACE -opt2) +set_target_properties(foo2 PROPERTIES + INTERFACE_LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/dep2" + ) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dep2" "") + +add_library(foo3 STATIC empty.c) +target_link_directories(foo3 PRIVATE dir3) +target_link_options(foo3 PRIVATE -opt3) +set_target_properties(foo3 PROPERTIES + LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/dep3" + ) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dep3" "") + +add_executable(main main.c) +target_link_libraries(main PRIVATE foo1) +target_link_directories(main PRIVATE dirM) +target_link_options(main PRIVATE -optM) +set_target_properties(main PROPERTIES + LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/depM" + ) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/depM" "") + +file(GENERATE OUTPUT out.txt CONTENT "# file(GENERATE) produced: +main LINK_LIBRARIES: '$<TARGET_PROPERTY:main,LINK_LIBRARIES>' # not transitive +main LINK_DIRECTORIES: '$<TARGET_PROPERTY:main,LINK_DIRECTORIES>' +main LINK_OPTIONS: '$<TARGET_PROPERTY:main,LINK_OPTIONS>' +main LINK_DEPENDS: '$<TARGET_PROPERTY:main,LINK_DEPENDS>' +") |