summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-05-15 19:19:20 (GMT)
committerBrad King <brad.king@kitware.com>2013-05-31 14:00:42 (GMT)
commitb680824a5fdcc54c265c64ce8958f9d80acad70d (patch)
tree8e3cc0c24ccea5ad0294e191eb3f05a69a97fc69 /Tests
parent5377ac42896402510571fa0ee26c6bf32f132e21 (diff)
downloadCMake-b680824a5fdcc54c265c64ce8958f9d80acad70d.zip
CMake-b680824a5fdcc54c265c64ce8958f9d80acad70d.tar.gz
CMake-b680824a5fdcc54c265c64ce8958f9d80acad70d.tar.bz2
try_compile: Add test for bad call error cases
Add a RunCMake.try_compile test to cover cases of bad invocation of the try_compile command.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/try_compile/BadLinkLibraries-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt5
-rw-r--r--Tests/RunCMake/try_compile/BadLinkLibraries.cmake3
-rw-r--r--Tests/RunCMake/try_compile/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/try_compile/NoArgs-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NoArgs-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/NoArgs.cmake1
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile.cmake2
-rw-r--r--Tests/RunCMake/try_compile/NoLinkLibraries-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NoLinkLibraries-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/NoLinkLibraries.cmake2
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable.cmake2
-rw-r--r--Tests/RunCMake/try_compile/NonSourceCompileDefinitions-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/NonSourceCompileDefinitions.cmake2
-rw-r--r--Tests/RunCMake/try_compile/NonSourceCopyFile-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/NonSourceCopyFile.cmake2
-rw-r--r--Tests/RunCMake/try_compile/OneArg-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/OneArg-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/OneArg.cmake1
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/try_compile/TwoArgs-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/TwoArgs-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/TwoArgs.cmake1
-rw-r--r--Tests/RunCMake/try_compile/proj/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/try_compile/src.c1
32 files changed, 80 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 66f86b6..f1e01b1 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -76,6 +76,7 @@ add_RunCMake_test(if)
add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(list)
+add_RunCMake_test(try_compile)
add_RunCMake_test(CMP0004)
find_package(Qt4 QUIET)
diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries-result.txt b/Tests/RunCMake/try_compile/BadLinkLibraries-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BadLinkLibraries-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
new file mode 100644
index 0000000..eceffec
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at BadLinkLibraries.cmake:2 \(try_compile\):
+ Only libraries may be used as try_compile 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_compile/BadLinkLibraries.cmake b/Tests/RunCMake/try_compile/BadLinkLibraries.cmake
new file mode 100644
index 0000000..e8b5add
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BadLinkLibraries.cmake
@@ -0,0 +1,3 @@
+add_custom_target(not_a_library)
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ LINK_LIBRARIES not_a_library)
diff --git a/Tests/RunCMake/try_compile/CMakeLists.txt b/Tests/RunCMake/try_compile/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/try_compile/NoArgs-result.txt b/Tests/RunCMake/try_compile/NoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NoArgs-stderr.txt b/Tests/RunCMake/try_compile/NoArgs-stderr.txt
new file mode 100644
index 0000000..8808fd1
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoArgs-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NoArgs.cmake:1 \(try_compile\):
+ try_compile unknown error.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoArgs.cmake b/Tests/RunCMake/try_compile/NoArgs.cmake
new file mode 100644
index 0000000..8f751d9
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoArgs.cmake
@@ -0,0 +1 @@
+try_compile()
diff --git a/Tests/RunCMake/try_compile/NoCopyFile-result.txt b/Tests/RunCMake/try_compile/NoCopyFile-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoCopyFile-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt
new file mode 100644
index 0000000..096fd98
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NoCopyFile.cmake:1 \(try_compile\):
+ COPY_FILE specified but there is no variable
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoCopyFile.cmake b/Tests/RunCMake/try_compile/NoCopyFile.cmake
new file mode 100644
index 0000000..8c648ff
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoCopyFile.cmake
@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE)
diff --git a/Tests/RunCMake/try_compile/NoLinkLibraries-result.txt b/Tests/RunCMake/try_compile/NoLinkLibraries-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoLinkLibraries-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NoLinkLibraries-stderr.txt b/Tests/RunCMake/try_compile/NoLinkLibraries-stderr.txt
new file mode 100644
index 0000000..507dce0
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoLinkLibraries-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NoLinkLibraries.cmake:1 \(try_compile\):
+ LINK_LIBRARIES specified but there is no content
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoLinkLibraries.cmake b/Tests/RunCMake/try_compile/NoLinkLibraries.cmake
new file mode 100644
index 0000000..04c5758
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoLinkLibraries.cmake
@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ LINK_LIBRARIES)
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable-result.txt b/Tests/RunCMake/try_compile/NoOutputVariable-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoOutputVariable-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt b/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt
new file mode 100644
index 0000000..77ede4c
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NoOutputVariable.cmake:1 \(try_compile\):
+ OUTPUT_VARIABLE specified but there is no variable
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable.cmake b/Tests/RunCMake/try_compile/NoOutputVariable.cmake
new file mode 100644
index 0000000..3b9cb34
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoOutputVariable.cmake
@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ OUTPUT_VARIABLE)
diff --git a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-result.txt b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt
new file mode 100644
index 0000000..cf02efb
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NonSourceCompileDefinitions.cmake:1 \(try_compile\):
+ COMPILE_FLAGS specified on a srcdir type TRY_COMPILE
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions.cmake b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions.cmake
new file mode 100644
index 0000000..8eb0d47
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions.cmake
@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/proj
+ TestProject COMPILE_DEFINITIONS DEF)
diff --git a/Tests/RunCMake/try_compile/NonSourceCopyFile-result.txt b/Tests/RunCMake/try_compile/NonSourceCopyFile-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NonSourceCopyFile-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt b/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt
new file mode 100644
index 0000000..f5893e1
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NonSourceCopyFile.cmake:1 \(try_compile\):
+ COPY_FILE specified on a srcdir type TRY_COMPILE
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NonSourceCopyFile.cmake b/Tests/RunCMake/try_compile/NonSourceCopyFile.cmake
new file mode 100644
index 0000000..c44192f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NonSourceCopyFile.cmake
@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/proj
+ TestProject COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/result)
diff --git a/Tests/RunCMake/try_compile/OneArg-result.txt b/Tests/RunCMake/try_compile/OneArg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OneArg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/OneArg-stderr.txt b/Tests/RunCMake/try_compile/OneArg-stderr.txt
new file mode 100644
index 0000000..12835be
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OneArg-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at OneArg.cmake:1 \(try_compile\):
+ try_compile unknown error.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/OneArg.cmake b/Tests/RunCMake/try_compile/OneArg.cmake
new file mode 100644
index 0000000..e60a462
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OneArg.cmake
@@ -0,0 +1 @@
+try_compile(RESULT)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
new file mode 100644
index 0000000..a4248ec
--- /dev/null
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -0,0 +1,11 @@
+include(RunCMake)
+
+run_cmake(NoArgs)
+run_cmake(OneArg)
+run_cmake(TwoArgs)
+run_cmake(NoCopyFile)
+run_cmake(NoOutputVariable)
+run_cmake(NoLinkLibraries)
+run_cmake(BadLinkLibraries)
+run_cmake(NonSourceCopyFile)
+run_cmake(NonSourceCompileDefinitions)
diff --git a/Tests/RunCMake/try_compile/TwoArgs-result.txt b/Tests/RunCMake/try_compile/TwoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/TwoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
new file mode 100644
index 0000000..b9c08fc
--- /dev/null
+++ b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at TwoArgs.cmake:1 \(try_compile\):
+ try_compile unknown error.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/TwoArgs.cmake b/Tests/RunCMake/try_compile/TwoArgs.cmake
new file mode 100644
index 0000000..7f2212d
--- /dev/null
+++ b/Tests/RunCMake/try_compile/TwoArgs.cmake
@@ -0,0 +1 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/Tests/RunCMake/try_compile/proj/CMakeLists.txt b/Tests/RunCMake/try_compile/proj/CMakeLists.txt
new file mode 100644
index 0000000..78a87c0
--- /dev/null
+++ b/Tests/RunCMake/try_compile/proj/CMakeLists.txt
@@ -0,0 +1,2 @@
+cmake_minimum_required(VERSION 2.8.10)
+project(TestProject NONE)
diff --git a/Tests/RunCMake/try_compile/src.c b/Tests/RunCMake/try_compile/src.c
new file mode 100644
index 0000000..78f2de1
--- /dev/null
+++ b/Tests/RunCMake/try_compile/src.c
@@ -0,0 +1 @@
+int main(void) { return 0; }