summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-02-04 13:22:13 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-02-04 13:22:19 (GMT)
commit4cd23c5e0d5835781b95f6eda778a35d2f55beb8 (patch)
treeb1d1b4380ae20258cf37efd1df15ef2ba21c698e /Tests/RunCMake
parentbf6e6550315097db430b5d5773e6973facd5ad17 (diff)
parent5af38a11ce8da342006bb29d6af00596f79e002c (diff)
downloadCMake-4cd23c5e0d5835781b95f6eda778a35d2f55beb8.zip
CMake-4cd23c5e0d5835781b95f6eda778a35d2f55beb8.tar.gz
CMake-4cd23c5e0d5835781b95f6eda778a35d2f55beb8.tar.bz2
Merge topic 'issue-17634'
5af38a11ce try_run: Allow to set working directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5757
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/try_run/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/try_run/WorkingDirArg.cmake9
2 files changed, 11 insertions, 0 deletions
diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake
index 3689562..fa30eb4 100644
--- a/Tests/RunCMake/try_run/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake
@@ -8,3 +8,5 @@ if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
run_cmake(LinkOptions)
unset (RunCMake_TEST_OPTIONS)
endif()
+
+run_cmake(WorkingDirArg)
diff --git a/Tests/RunCMake/try_run/WorkingDirArg.cmake b/Tests/RunCMake/try_run/WorkingDirArg.cmake
new file mode 100644
index 0000000..b583823
--- /dev/null
+++ b/Tests/RunCMake/try_run/WorkingDirArg.cmake
@@ -0,0 +1,9 @@
+try_run(RUN_RESULT COMPILE_RESULT
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ RUN_OUTPUT_VARIABLE OUTPUT_VARIABLE
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/workdir
+ )
+
+if(RUN_RESULT)
+ message(SEND_ERROR "try run failed with result: ${RUN_RESULT}")
+endif()