summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-08-11 14:44:14 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-08-11 14:50:52 (GMT)
commit2ccb897d86598daa983f77ce764411c5723b568c (patch)
treef12a2bab221a7dff8efa4b08bffd6bc7f92772e6 /Tests
parent84e76fedb0255ac4d0524f47268be79598b096fc (diff)
downloadCMake-2ccb897d86598daa983f77ce764411c5723b568c.zip
CMake-2ccb897d86598daa983f77ce764411c5723b568c.tar.gz
CMake-2ccb897d86598daa983f77ce764411c5723b568c.tar.bz2
get_test_property(): Add DIRECTORY option
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/get_property/test_properties-stderr.txt10
-rw-r--r--Tests/RunCMake/get_property/test_properties.cmake19
-rw-r--r--Tests/RunCMake/get_property/test_properties/CMakeLists.txt4
3 files changed, 25 insertions, 8 deletions
diff --git a/Tests/RunCMake/get_property/test_properties-stderr.txt b/Tests/RunCMake/get_property/test_properties-stderr.txt
index a447280..9f5a10f 100644
--- a/Tests/RunCMake/get_property/test_properties-stderr.txt
+++ b/Tests/RunCMake/get_property/test_properties-stderr.txt
@@ -1,6 +1,12 @@
-^get_test_property: --><--
+^get_test_property: -->value<--
+get_property: -->value<--
+get_test_property: --><--
get_property: --><--
get_test_property: -->value<--
get_property: -->value<--
get_test_property: -->NOTFOUND<--
-get_property: --><--$
+get_property: --><--
+get_test_property: -->anotherValue<--
+get_property: -->anotherValue<--
+get_test_property: -->anotherValue<--
+get_property: -->anotherValue<--$
diff --git a/Tests/RunCMake/get_property/test_properties.cmake b/Tests/RunCMake/get_property/test_properties.cmake
index 1d0295c..f1cbca4 100644
--- a/Tests/RunCMake/get_property/test_properties.cmake
+++ b/Tests/RunCMake/get_property/test_properties.cmake
@@ -1,7 +1,11 @@
-function (check_test_property test prop)
- get_test_property("${test}" "${prop}" gtp_val)
+function (check_test_property test prop dir)
+ set(dir_args)
+ if(dir)
+ set(dir_args DIRECTORY ${dir})
+ endif()
+ get_test_property("${test}" "${prop}" ${dir_args} gtp_val)
get_property(gp_val
- TEST "${test}"
+ TEST "${test}" ${dir_args}
PROPERTY "${prop}")
message("get_test_property: -->${gtp_val}<--")
@@ -11,7 +15,10 @@ endfunction ()
include(CTest)
add_test(NAME test COMMAND "${CMAKE_COMMAND}" --help)
set_tests_properties(test PROPERTIES empty "" custom value)
+add_subdirectory(test_properties)
-check_test_property(test empty)
-check_test_property(test custom)
-check_test_property(test noexist)
+check_test_property(test empty "")
+check_test_property(test custom "")
+check_test_property(test noexist "")
+check_test_property(test custom test_properties)
+check_test_property(test custom ${CMAKE_BINARY_DIR}/test_properties)
diff --git a/Tests/RunCMake/get_property/test_properties/CMakeLists.txt b/Tests/RunCMake/get_property/test_properties/CMakeLists.txt
new file mode 100644
index 0000000..ee90344
--- /dev/null
+++ b/Tests/RunCMake/get_property/test_properties/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_test(NAME test COMMAND "${CMAKE_COMMAND}" --help)
+set_tests_properties(test PROPERTIES empty "" custom anotherValue)
+
+check_test_property(test custom ..)