summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorMatt McCormick <matt.mccormick@kitware.com>2015-01-23 00:13:56 (GMT)
committerBrad King <brad.king@kitware.com>2015-01-26 15:05:30 (GMT)
commit223c5cb70b30b6a790fd916321f60c86d459e15e (patch)
tree3c92140db3446f2ccabb60ff5ee4a75820e4dd39 /Tests
parente2b1f0583f7293bce280dfab397e96acf8a5b26e (diff)
downloadCMake-223c5cb70b30b6a790fd916321f60c86d459e15e.zip
CMake-223c5cb70b30b6a790fd916321f60c86d459e15e.tar.gz
CMake-223c5cb70b30b6a790fd916321f60c86d459e15e.tar.bz2
try_run: Add test for bad link libraries.
Based off the corresponding try_compile test.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/try_run/BadLinkLibraries-result.txt1
-rw-r--r--Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt5
-rw-r--r--Tests/RunCMake/try_run/BadLinkLibraries.cmake4
-rw-r--r--Tests/RunCMake/try_run/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/try_run/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/try_run/src.c1
7 files changed, 18 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index b5e41d9..78d375e 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -130,6 +130,7 @@ add_RunCMake_test(project)
add_RunCMake_test(return)
add_RunCMake_test(string)
add_RunCMake_test(try_compile)
+add_RunCMake_test(try_run)
add_RunCMake_test(set)
add_RunCMake_test(variable_watch)
add_RunCMake_test(CMP0004)
diff --git a/Tests/RunCMake/try_run/BadLinkLibraries-result.txt b/Tests/RunCMake/try_run/BadLinkLibraries-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_run/BadLinkLibraries-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt
new file mode 100644
index 0000000..dcd1bfc
--- /dev/null
+++ b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at BadLinkLibraries.cmake:2 \(try_run\):
+ Only libraries may be used as try_compile or try_run IMPORTED
+ LINK_LIBRARIES. Got not_a_library of type UTILITY.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_run/BadLinkLibraries.cmake b/Tests/RunCMake/try_run/BadLinkLibraries.cmake
new file mode 100644
index 0000000..a124bf6
--- /dev/null
+++ b/Tests/RunCMake/try_run/BadLinkLibraries.cmake
@@ -0,0 +1,4 @@
+add_custom_target(not_a_library)
+try_run(RUN_RESULT COMPILE_RESULT
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ LINK_LIBRARIES not_a_library)
diff --git a/Tests/RunCMake/try_run/CMakeLists.txt b/Tests/RunCMake/try_run/CMakeLists.txt
new file mode 100644
index 0000000..e034780
--- /dev/null
+++ b/Tests/RunCMake/try_run/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.0)
+project(${RunCMake_TEST} C)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake
new file mode 100644
index 0000000..1ec9a55
--- /dev/null
+++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(BadLinkLibraries)
diff --git a/Tests/RunCMake/try_run/src.c b/Tests/RunCMake/try_run/src.c
new file mode 100644
index 0000000..78f2de1
--- /dev/null
+++ b/Tests/RunCMake/try_run/src.c
@@ -0,0 +1 @@
+int main(void) { return 0; }