summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/try_run
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-06-15 18:30:35 (GMT)
committerBrad King <brad.king@kitware.com>2022-07-26 18:41:28 (GMT)
commit31ee3cd49d3fb27458cec92602e3240066d97c2c (patch)
tree2077883efbdea86b010f35e87e0c69bf015410c7 /Tests/RunCMake/try_run
parent5fc4e121a18d9e403f1541348c2889e9bc153791 (diff)
downloadCMake-31ee3cd49d3fb27458cec92602e3240066d97c2c.zip
CMake-31ee3cd49d3fb27458cec92602e3240066d97c2c.tar.gz
CMake-31ee3cd49d3fb27458cec92602e3240066d97c2c.tar.bz2
try_compile: Fail earlier when bindir is not an absolute path
If the bindir is not an absolute path, other errors occur later. Fail early with a clear error in this case.
Diffstat (limited to 'Tests/RunCMake/try_run')
-rw-r--r--Tests/RunCMake/try_run/BinDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_run/BinDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_run/BinDirEmpty.cmake1
-rw-r--r--Tests/RunCMake/try_run/BinDirRelative-result.txt1
-rw-r--r--Tests/RunCMake/try_run/BinDirRelative-stderr.txt6
-rw-r--r--Tests/RunCMake/try_run/BinDirRelative.cmake1
-rw-r--r--Tests/RunCMake/try_run/RunCMakeTest.cmake2
7 files changed, 16 insertions, 0 deletions
diff --git a/Tests/RunCMake/try_run/BinDirEmpty-result.txt b/Tests/RunCMake/try_run/BinDirEmpty-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt b/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt
new file mode 100644
index 0000000..def1c22
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at BinDirEmpty.cmake:[0-9]+ \(try_run\):
+ No <bindir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_run/BinDirEmpty.cmake b/Tests/RunCMake/try_run/BinDirEmpty.cmake
new file mode 100644
index 0000000..d4b7ee3
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirEmpty.cmake
@@ -0,0 +1 @@
+try_run(runResultVar compileResultVar "" ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_run/BinDirRelative-result.txt b/Tests/RunCMake/try_run/BinDirRelative-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirRelative-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/BinDirRelative-stderr.txt b/Tests/RunCMake/try_run/BinDirRelative-stderr.txt
new file mode 100644
index 0000000..54d4e86
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirRelative-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at BinDirRelative.cmake:[0-9]+ \(try_run\):
+ <bindir> is not an absolute path:
+
+ 'bin_dir_relative'
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_run/BinDirRelative.cmake b/Tests/RunCMake/try_run/BinDirRelative.cmake
new file mode 100644
index 0000000..a277403
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirRelative.cmake
@@ -0,0 +1 @@
+try_run(runResultVar compileResultVar bin_dir_relative ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake
index 5fa5b2f..76c85dd 100644
--- a/Tests/RunCMake/try_run/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake
@@ -1,6 +1,8 @@
include(RunCMake)
run_cmake(BadLinkLibraries)
+run_cmake(BinDirEmpty)
+run_cmake(BinDirRelative)
if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$")