summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-02 11:39:36 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-06-02 11:39:44 (GMT)
commitcf470d8dac5abe956b7a0ec62afe2d93fb533336 (patch)
treefe684de51228c658d4ebd0f8d8ca76d6fddf8390 /Tests
parent399a321a6421343318e52c093e900e4fabdaecca (diff)
parent1cb4f592a09752972d89785c0e8f1e160d5b5c4e (diff)
downloadCMake-cf470d8dac5abe956b7a0ec62afe2d93fb533336.zip
CMake-cf470d8dac5abe956b7a0ec62afe2d93fb533336.tar.gz
CMake-cf470d8dac5abe956b7a0ec62afe2d93fb533336.tar.bz2
Merge topic 'command_target'
1cb4f592a0 add_custom_command: Target-dependent generator expression support Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6176
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/add_custom_command/RunCMakeTest.cmake17
-rw-r--r--Tests/RunCMake/add_custom_command/TargetGenexEvent.cmake10
2 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
index 9c59b4b..ad6b258 100644
--- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
@@ -43,3 +43,20 @@ if(NOT RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
endif()
+
+function(test_genex name)
+ run_cmake(${name})
+
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}-build")
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .)
+
+ if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/wdir/touched")
+ message(SEND_ERROR "File not created by target-dependent add_custom_command()!")
+ endif()
+
+ unset(RunCMake_TEST_NO_CLEAN)
+ unset(RunCMake_TEST_BINARY_DIR)
+endfunction()
+
+test_genex(TargetGenexEvent)
diff --git a/Tests/RunCMake/add_custom_command/TargetGenexEvent.cmake b/Tests/RunCMake/add_custom_command/TargetGenexEvent.cmake
new file mode 100644
index 0000000..8591b74
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/TargetGenexEvent.cmake
@@ -0,0 +1,10 @@
+add_custom_target(target ALL)
+set_target_properties(target PROPERTIES COMPILE_DEFINITIONS "touched" COMPILE_OPTIONS "${CMAKE_BINARY_DIR}/wdir")
+file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/wdir")
+
+add_custom_command(
+ TARGET target
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E touch $<TARGET_PROPERTY:COMPILE_DEFINITIONS>
+ WORKING_DIRECTORY $<TARGET_PROPERTY:COMPILE_OPTIONS>
+)