summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/try_run
diff options
context:
space:
mode:
authorAsit Dhal <dhal.asitk@gmail.com>2021-01-31 16:57:39 (GMT)
committerAsit Dhal <dhal.asitk@gmail.com>2021-02-03 07:42:05 (GMT)
commit5af38a11ce8da342006bb29d6af00596f79e002c (patch)
tree078050ad13f867021b49e2a05d62db5c4f8eab23 /Tests/RunCMake/try_run
parentaf695cee7346fa0eee478f71952fd02f0df989cf (diff)
downloadCMake-5af38a11ce8da342006bb29d6af00596f79e002c.zip
CMake-5af38a11ce8da342006bb29d6af00596f79e002c.tar.gz
CMake-5af38a11ce8da342006bb29d6af00596f79e002c.tar.bz2
try_run: Allow to set working directory
Fixes: #17634
Diffstat (limited to 'Tests/RunCMake/try_run')
-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()