summaryrefslogtreecommitdiff
path: root/Tests/RunCMake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt58
-rw-r--r--Tests/RunCMake/Languages/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Languages/NoLangSHARED-result.txt1
-rw-r--r--Tests/RunCMake/Languages/NoLangSHARED-stderr.txt1
-rw-r--r--Tests/RunCMake/Languages/NoLangSHARED.cmake1
-rw-r--r--Tests/RunCMake/Languages/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/Languages/foo.nolang0
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadObjSource1-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt8
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadObjSource1.cmake1
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt8
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadObjSource2.cmake1
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression1-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression1-stderr.txt6
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression1.cmake1
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression2-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression2-stderr.txt4
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression2.cmake1
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression3-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt4
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/ObjectLibrary/Export-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/Export-stderr.txt4
-rw-r--r--Tests/RunCMake/ObjectLibrary/Export.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake15
-rw-r--r--Tests/RunCMake/ObjectLibrary/Import-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/Import-stderr.txt4
-rw-r--r--Tests/RunCMake/ObjectLibrary/Import.cmake1
-rw-r--r--Tests/RunCMake/ObjectLibrary/Install-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/Install-stderr.txt4
-rw-r--r--Tests/RunCMake/ObjectLibrary/Install.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt4
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt6
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake3
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt6
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake3
-rw-r--r--Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt4
-rw-r--r--Tests/RunCMake/ObjectLibrary/ObjWithObj.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/PostBuild-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/PostBuild-stderr.txt5
-rw-r--r--Tests/RunCMake/ObjectLibrary/PostBuild.cmake4
-rw-r--r--Tests/RunCMake/ObjectLibrary/PreBuild-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/PreBuild-stderr.txt5
-rw-r--r--Tests/RunCMake/ObjectLibrary/PreBuild.cmake4
-rw-r--r--Tests/RunCMake/ObjectLibrary/PreLink-result.txt1
-rw-r--r--Tests/RunCMake/ObjectLibrary/PreLink-stderr.txt5
-rw-r--r--Tests/RunCMake/ObjectLibrary/PreLink.cmake4
-rw-r--r--Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake18
-rw-r--r--Tests/RunCMake/ObjectLibrary/a.c1
-rw-r--r--Tests/RunCMake/ObjectLibrary/a.cxx1
-rw-r--r--Tests/RunCMake/ObjectLibrary/bad.def0
-rw-r--r--Tests/RunCMake/ObjectLibrary/bad.obj0
-rw-r--r--Tests/RunCMake/RunCMake.cmake74
-rw-r--r--Tests/RunCMake/build_command/CMakeLists.txt59
-rw-r--r--Tests/RunCMake/build_command/ErrorsOFF-stderr.txt1
-rw-r--r--Tests/RunCMake/build_command/ErrorsOFF-stdout.txt1
-rw-r--r--Tests/RunCMake/build_command/ErrorsOFF.cmake1
-rw-r--r--Tests/RunCMake/build_command/ErrorsON-result.txt1
-rw-r--r--Tests/RunCMake/build_command/ErrorsON-stderr.txt12
-rw-r--r--Tests/RunCMake/build_command/ErrorsON-stdout.txt1
-rw-r--r--Tests/RunCMake/build_command/ErrorsON.cmake1
-rw-r--r--Tests/RunCMake/build_command/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/find_package/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/find_package/ComponentRequiredAndOptional-result.txt1
-rw-r--r--Tests/RunCMake/find_package/ComponentRequiredAndOptional-stderr.txt8
-rw-r--r--Tests/RunCMake/find_package/ComponentRequiredAndOptional.cmake1
-rw-r--r--Tests/RunCMake/find_package/MissingConfig-stderr.txt19
-rw-r--r--Tests/RunCMake/find_package/MissingConfig.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt10
-rw-r--r--Tests/RunCMake/find_package/MissingConfigOneName.cmake1
-rw-r--r--Tests/RunCMake/find_package/MissingConfigRequired-result.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt13
-rw-r--r--Tests/RunCMake/find_package/MissingConfigRequired.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt13
-rw-r--r--Tests/RunCMake/find_package/MissingConfigVersion.cmake1
-rw-r--r--Tests/RunCMake/find_package/MissingModule-stderr.txt26
-rw-r--r--Tests/RunCMake/find_package/MissingModule.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingModuleRequired-result.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt21
-rw-r--r--Tests/RunCMake/find_package/MissingModuleRequired.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingNormal-stderr.txt23
-rw-r--r--Tests/RunCMake/find_package/MissingNormal.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingNormalRequired-result.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt17
-rw-r--r--Tests/RunCMake/find_package/MissingNormalRequired.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt17
-rw-r--r--Tests/RunCMake/find_package/MissingNormalVersion.cmake1
-rw-r--r--Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt30
-rw-r--r--Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake3
-rw-r--r--Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt29
-rw-r--r--Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake2
-rw-r--r--Tests/RunCMake/find_package/MixedModeOptions-result.txt1
-rw-r--r--Tests/RunCMake/find_package/MixedModeOptions-stderr.txt14
-rw-r--r--Tests/RunCMake/find_package/MixedModeOptions.cmake1
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake16
-rw-r--r--Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt9
-rw-r--r--Tests/RunCMake/find_package/SetFoundFALSE.cmake2
-rw-r--r--Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake1
-rw-r--r--Tests/RunCMake/include/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/include/EmptyString-stderr.txt5
-rw-r--r--Tests/RunCMake/include/EmptyString.cmake1
-rw-r--r--Tests/RunCMake/include/EmptyStringOptional-stderr.txt5
-rw-r--r--Tests/RunCMake/include/EmptyStringOptional.cmake1
-rw-r--r--Tests/RunCMake/include/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/include_external_msproject/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/include_external_msproject/CustomGuid-check.cmake1
-rw-r--r--Tests/RunCMake/include_external_msproject/CustomGuid.cmake2
-rw-r--r--Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check.cmake1
-rw-r--r--Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform.cmake5
-rw-r--r--Tests/RunCMake/include_external_msproject/CustomTypePlatform-check.cmake1
-rw-r--r--Tests/RunCMake/include_external_msproject/CustomTypePlatform.cmake3
-rw-r--r--Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/include_external_msproject/check_utils.cmake109
-rw-r--r--Tests/RunCMake/include_external_msproject/main.cpp3
-rw-r--r--Tests/RunCMake/list/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/list/EmptyGet0-result.txt1
-rw-r--r--Tests/RunCMake/list/EmptyGet0-stderr.txt4
-rw-r--r--Tests/RunCMake/list/EmptyGet0.cmake2
-rw-r--r--Tests/RunCMake/list/EmptyInsert-1-result.txt1
-rw-r--r--Tests/RunCMake/list/EmptyInsert-1-stderr.txt4
-rw-r--r--Tests/RunCMake/list/EmptyInsert-1.cmake2
-rw-r--r--Tests/RunCMake/list/EmptyRemoveAt0-result.txt1
-rw-r--r--Tests/RunCMake/list/EmptyRemoveAt0-stderr.txt4
-rw-r--r--Tests/RunCMake/list/EmptyRemoveAt0.cmake2
-rw-r--r--Tests/RunCMake/list/RunCMakeTest.cmake5
132 files changed, 865 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
new file mode 100644
index 000000000..eca96f907
--- /dev/null
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -0,0 +1,58 @@
+# This directory contains tests that run CMake to configure a project
+# but do not actually build anything. To add a test:
+#
+# 1.) Add a subdirectory named for the test.
+#
+# 2.) Call add_RunCMake_test and pass the test directory name.
+#
+# 3.) Create a RunCMakeTest.cmake script in the directory containing
+# include(RunCMake)
+# run_cmake(SubTest1)
+# ...
+# run_cmake(SubTestN)
+# where SubTest1..SubTestN are sub-test names each corresponding to
+# an independent CMake run and project configuration.
+#
+# 3.) Create a CMakeLists.txt file in the directory containing
+# cmake_minimum_required(...)
+# project(${RunCMake_TEST} NONE) # or languages needed
+# include(${RunCMake_TEST}.cmake)
+# where "${RunCMake_TEST}" is literal. A value for RunCMake_TEST
+# will be passed to CMake by the run_cmake macro when running each
+# sub-test.
+#
+# 4.) Create a <SubTest>.cmake file for each sub-test named above
+# containing the actual test code. Optionally create files
+# containing expected test results:
+# <SubTest>-result.txt = Process result expected if not "0"
+# <SubTest>-stdout.txt = Regex matching expected stdout content
+# <SubTest>-stderr.txt = Regex matching expected stderr content
+# <SubTest>-check.cmake = Custom result check
+# Note that trailing newlines will be stripped from actual test
+# output before matching against the stdout and stderr expressions.
+# The code in <SubTest>-check.cmake may use variables
+# RunCMake_TEST_SOURCE_DIR = Top of test source tree
+# RunCMake_TEST_BINARY_DIR = Top of test binary tree
+# and an failure must store a message in RunCMake_TEST_FAILED.
+
+macro(add_RunCMake_test test)
+ add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND}
+ -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
+ -DRunCMake_GENERATOR=${CMAKE_TEST_GENERATOR}
+ -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
+ -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test}
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
+ )
+endmacro()
+
+add_RunCMake_test(Languages)
+add_RunCMake_test(ObjectLibrary)
+
+add_RunCMake_test(build_command)
+add_RunCMake_test(find_package)
+add_RunCMake_test(include)
+add_RunCMake_test(list)
+
+if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
+ add_RunCMake_test(include_external_msproject)
+endif()
diff --git a/Tests/RunCMake/Languages/CMakeLists.txt b/Tests/RunCMake/Languages/CMakeLists.txt
new file mode 100644
index 000000000..e8db6b05b
--- /dev/null
+++ b/Tests/RunCMake/Languages/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/Languages/NoLangSHARED-result.txt b/Tests/RunCMake/Languages/NoLangSHARED-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/Languages/NoLangSHARED-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Languages/NoLangSHARED-stderr.txt b/Tests/RunCMake/Languages/NoLangSHARED-stderr.txt
new file mode 100644
index 000000000..3f93cf86c
--- /dev/null
+++ b/Tests/RunCMake/Languages/NoLangSHARED-stderr.txt
@@ -0,0 +1 @@
+CMake Error: CMake can not determine linker language for target:NoLang
diff --git a/Tests/RunCMake/Languages/NoLangSHARED.cmake b/Tests/RunCMake/Languages/NoLangSHARED.cmake
new file mode 100644
index 000000000..de6adf7cb
--- /dev/null
+++ b/Tests/RunCMake/Languages/NoLangSHARED.cmake
@@ -0,0 +1 @@
+add_library(NoLang SHARED foo.nolang)
diff --git a/Tests/RunCMake/Languages/RunCMakeTest.cmake b/Tests/RunCMake/Languages/RunCMakeTest.cmake
new file mode 100644
index 000000000..a99548f05
--- /dev/null
+++ b/Tests/RunCMake/Languages/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(NoLangSHARED)
diff --git a/Tests/RunCMake/Languages/foo.nolang b/Tests/RunCMake/Languages/foo.nolang
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/Languages/foo.nolang
diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource1-result.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource1-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadObjSource1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt
new file mode 100644
index 000000000..b31225b48
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at BadObjSource1.cmake:1 \(add_library\):
+ OBJECT library "A" contains:
+
+ bad.def
+
+ but may contain only headers and sources that compile.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource1.cmake b/Tests/RunCMake/ObjectLibrary/BadObjSource1.cmake
new file mode 100644
index 000000000..aa3514d90
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadObjSource1.cmake
@@ -0,0 +1 @@
+add_library(A OBJECT a.c bad.def)
diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt
new file mode 100644
index 000000000..906cf0b64
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at BadObjSource2.cmake:1 \(add_library\):
+ OBJECT library "A" contains:
+
+ bad.obj
+
+ but may contain only headers and sources that compile.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2.cmake b/Tests/RunCMake/ObjectLibrary/BadObjSource2.cmake
new file mode 100644
index 000000000..7957c99f2
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadObjSource2.cmake
@@ -0,0 +1 @@
+add_library(A OBJECT a.c bad.obj)
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression1-result.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression1-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression1-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression1-stderr.txt
new file mode 100644
index 000000000..a1cac36fa
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression1-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at BadSourceExpression1.cmake:1 \(add_library\):
+ Unrecognized generator expression:
+
+ \$<BAD_EXPRESSION>
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression1.cmake b/Tests/RunCMake/ObjectLibrary/BadSourceExpression1.cmake
new file mode 100644
index 000000000..020c9a00f
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression1.cmake
@@ -0,0 +1 @@
+add_library(A STATIC a.c $<BAD_EXPRESSION>)
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression2-result.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression2-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression2-stderr.txt
new file mode 100644
index 000000000..f1fcbe85f
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression2-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at BadSourceExpression2.cmake:1 \(add_library\):
+ Objects of target "DoesNotExist" referenced but no such target exists.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression2.cmake b/Tests/RunCMake/ObjectLibrary/BadSourceExpression2.cmake
new file mode 100644
index 000000000..ed5dc4335
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression2.cmake
@@ -0,0 +1 @@
+add_library(A STATIC a.c $<TARGET_OBJECTS:DoesNotExist>)
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-result.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt
new file mode 100644
index 000000000..ad14a3513
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at BadSourceExpression3.cmake:2 \(add_library\):
+ Objects of target "NotObjLib" referenced but is not an OBJECT library.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake
new file mode 100644
index 000000000..c3d9a622d
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3.cmake
@@ -0,0 +1,2 @@
+add_library(NotObjLib STATIC a.c)
+add_library(A STATIC a.c $<TARGET_OBJECTS:NotObjLib>)
diff --git a/Tests/RunCMake/ObjectLibrary/CMakeLists.txt b/Tests/RunCMake/ObjectLibrary/CMakeLists.txt
new file mode 100644
index 000000000..a7f077912
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} C)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/ObjectLibrary/Export-result.txt b/Tests/RunCMake/ObjectLibrary/Export-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/Export-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/Export-stderr.txt b/Tests/RunCMake/ObjectLibrary/Export-stderr.txt
new file mode 100644
index 000000000..bdadca488
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/Export-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at Export.cmake:2 \(export\):
+ export given OBJECT library "A" which may not be exported.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/Export.cmake b/Tests/RunCMake/ObjectLibrary/Export.cmake
new file mode 100644
index 000000000..a3f104e29
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/Export.cmake
@@ -0,0 +1,2 @@
+add_library(A OBJECT a.c)
+export(TARGETS A FILE AExport.cmake)
diff --git a/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake b/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake
new file mode 100644
index 000000000..0796c21ba
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake
@@ -0,0 +1,15 @@
+enable_language(CXX)
+add_library(A OBJECT a.cxx)
+add_library(B STATIC a.c $<TARGET_OBJECTS:A>)
+
+# Verify that object library languages are propagated.
+export(TARGETS B NAMESPACE Exp FILE BExport.cmake)
+include(${CMAKE_CURRENT_BINARY_DIR}/BExport.cmake)
+get_property(configs TARGET ExpB PROPERTY IMPORTED_CONFIGURATIONS)
+foreach(c ${configs})
+ get_property(langs TARGET ExpB PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES_${c})
+ list(FIND langs CXX pos)
+ if(${pos} LESS 0)
+ message(FATAL_ERROR "Target export does not list object library languages.")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/ObjectLibrary/Import-result.txt b/Tests/RunCMake/ObjectLibrary/Import-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/Import-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/Import-stderr.txt b/Tests/RunCMake/ObjectLibrary/Import-stderr.txt
new file mode 100644
index 000000000..74b496ab8
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/Import-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at Import.cmake:1 \(add_library\):
+ The OBJECT library type may not be used for IMPORTED libraries.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/Import.cmake b/Tests/RunCMake/ObjectLibrary/Import.cmake
new file mode 100644
index 000000000..806b44a25
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/Import.cmake
@@ -0,0 +1 @@
+add_library(A OBJECT IMPORTED)
diff --git a/Tests/RunCMake/ObjectLibrary/Install-result.txt b/Tests/RunCMake/ObjectLibrary/Install-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/Install-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/Install-stderr.txt b/Tests/RunCMake/ObjectLibrary/Install-stderr.txt
new file mode 100644
index 000000000..d2f9f4a37
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/Install-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at Install.cmake:2 \(install\):
+ install TARGETS given OBJECT library "A" which may not be installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/Install.cmake b/Tests/RunCMake/ObjectLibrary/Install.cmake
new file mode 100644
index 000000000..c1d214bd4
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/Install.cmake
@@ -0,0 +1,2 @@
+add_library(A OBJECT a.c)
+install(TARGETS A DESTINATION lib)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt
new file mode 100644
index 000000000..90e828bdb
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at LinkObjLHS.cmake:2 \(target_link_libraries\):
+ Object library target "AnObjLib" may not link to anything.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake
new file mode 100644
index 000000000..5d7831a23
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake
@@ -0,0 +1,2 @@
+add_library(AnObjLib OBJECT a.c)
+target_link_libraries(AnObjLib OtherLib)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt
new file mode 100644
index 000000000..8809f8933
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at LinkObjRHS1.cmake:3 \(target_link_libraries\):
+ Target "AnObjLib" of type OBJECT_LIBRARY may not be linked into another
+ target. One may link only to STATIC or SHARED libraries, or to executables
+ with the ENABLE_EXPORTS property set.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake
new file mode 100644
index 000000000..113d6a841
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake
@@ -0,0 +1,3 @@
+add_library(A STATIC a.c)
+add_library(AnObjLib OBJECT a.c)
+target_link_libraries(A AnObjLib)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt
new file mode 100644
index 000000000..3295fcac3
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at LinkObjRHS2.cmake:1 \(add_library\):
+ Target "A" links to OBJECT library "AnObjLib" but this is not allowed. One
+ may link only to STATIC or SHARED libraries, or to executables with the
+ ENABLE_EXPORTS property set.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake
new file mode 100644
index 000000000..616372949
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake
@@ -0,0 +1,3 @@
+add_library(A SHARED a.c)
+target_link_libraries(A AnObjLib)
+add_library(AnObjLib OBJECT a.c)
diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt b/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt b/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt
new file mode 100644
index 000000000..d67b4ae32
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at ObjWithObj.cmake:2 \(add_library\):
+ Only executables and non-OBJECT libraries may reference target objects.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj.cmake b/Tests/RunCMake/ObjectLibrary/ObjWithObj.cmake
new file mode 100644
index 000000000..d0ef34bfe
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/ObjWithObj.cmake
@@ -0,0 +1,2 @@
+add_library(A OBJECT a.c)
+add_library(B OBJECT $<TARGET_OBJECTS:A>)
diff --git a/Tests/RunCMake/ObjectLibrary/PostBuild-result.txt b/Tests/RunCMake/ObjectLibrary/PostBuild-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/PostBuild-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/PostBuild-stderr.txt b/Tests/RunCMake/ObjectLibrary/PostBuild-stderr.txt
new file mode 100644
index 000000000..4b067bbc3
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/PostBuild-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at PostBuild.cmake:2 \(add_custom_command\):
+ Target "A" is an OBJECT library that may not have PRE_BUILD, PRE_LINK, or
+ POST_BUILD commands.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/PostBuild.cmake b/Tests/RunCMake/ObjectLibrary/PostBuild.cmake
new file mode 100644
index 000000000..dea9a099e
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/PostBuild.cmake
@@ -0,0 +1,4 @@
+add_library(A OBJECT a.c)
+add_custom_command(TARGET A POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo "A post-build"
+ )
diff --git a/Tests/RunCMake/ObjectLibrary/PreBuild-result.txt b/Tests/RunCMake/ObjectLibrary/PreBuild-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/PreBuild-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/PreBuild-stderr.txt b/Tests/RunCMake/ObjectLibrary/PreBuild-stderr.txt
new file mode 100644
index 000000000..3b27a6da5
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/PreBuild-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at PreBuild.cmake:2 \(add_custom_command\):
+ Target "A" is an OBJECT library that may not have PRE_BUILD, PRE_LINK, or
+ POST_BUILD commands.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/PreBuild.cmake b/Tests/RunCMake/ObjectLibrary/PreBuild.cmake
new file mode 100644
index 000000000..e4424c100
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/PreBuild.cmake
@@ -0,0 +1,4 @@
+add_library(A OBJECT a.c)
+add_custom_command(TARGET A PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo "A pre-build"
+ )
diff --git a/Tests/RunCMake/ObjectLibrary/PreLink-result.txt b/Tests/RunCMake/ObjectLibrary/PreLink-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/PreLink-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/PreLink-stderr.txt b/Tests/RunCMake/ObjectLibrary/PreLink-stderr.txt
new file mode 100644
index 000000000..947b9f177
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/PreLink-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at PreLink.cmake:2 \(add_custom_command\):
+ Target "A" is an OBJECT library that may not have PRE_BUILD, PRE_LINK, or
+ POST_BUILD commands.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/PreLink.cmake b/Tests/RunCMake/ObjectLibrary/PreLink.cmake
new file mode 100644
index 000000000..b88905511
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/PreLink.cmake
@@ -0,0 +1,4 @@
+add_library(A OBJECT a.c)
+add_custom_command(TARGET A PRE_LINK
+ COMMAND ${CMAKE_COMMAND} -E echo "A pre-link"
+ )
diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
new file mode 100644
index 000000000..55db14dfd
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
@@ -0,0 +1,18 @@
+include(RunCMake)
+
+run_cmake(BadSourceExpression1)
+run_cmake(BadSourceExpression2)
+run_cmake(BadSourceExpression3)
+run_cmake(BadObjSource1)
+run_cmake(BadObjSource2)
+run_cmake(Export)
+run_cmake(ExportLanguages)
+run_cmake(Import)
+run_cmake(Install)
+run_cmake(LinkObjLHS)
+run_cmake(LinkObjRHS1)
+run_cmake(LinkObjRHS2)
+run_cmake(ObjWithObj)
+run_cmake(PostBuild)
+run_cmake(PreBuild)
+run_cmake(PreLink)
diff --git a/Tests/RunCMake/ObjectLibrary/a.c b/Tests/RunCMake/ObjectLibrary/a.c
new file mode 100644
index 000000000..af20d3ff6
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/a.c
@@ -0,0 +1 @@
+int a(void) { return 0; }
diff --git a/Tests/RunCMake/ObjectLibrary/a.cxx b/Tests/RunCMake/ObjectLibrary/a.cxx
new file mode 100644
index 000000000..ae9c87c49
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/a.cxx
@@ -0,0 +1 @@
+extern "C" int acxx(void) { return 0; }
diff --git a/Tests/RunCMake/ObjectLibrary/bad.def b/Tests/RunCMake/ObjectLibrary/bad.def
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/bad.def
diff --git a/Tests/RunCMake/ObjectLibrary/bad.obj b/Tests/RunCMake/ObjectLibrary/bad.obj
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/bad.obj
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
new file mode 100644
index 000000000..c3c161abe
--- /dev/null
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -0,0 +1,74 @@
+foreach(arg
+ RunCMake_GENERATOR
+ RunCMake_SOURCE_DIR
+ RunCMake_BINARY_DIR
+ )
+ if(NOT DEFINED ${arg})
+ message(FATAL_ERROR "${arg} not given!")
+ endif()
+endforeach()
+
+function(run_cmake test)
+ set(top_src "${RunCMake_SOURCE_DIR}")
+ set(top_bin "${RunCMake_BINARY_DIR}")
+ if(EXISTS ${top_src}/${test}-result.txt)
+ file(READ ${top_src}/${test}-result.txt expect_result)
+ string(REGEX REPLACE "\n+$" "" expect_result "${expect_result}")
+ else()
+ set(expect_result 0)
+ endif()
+ foreach(o out err)
+ if(EXISTS ${top_src}/${test}-std${o}.txt)
+ file(READ ${top_src}/${test}-std${o}.txt expect_std${o})
+ string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}")
+ else()
+ unset(expect_std${o})
+ endif()
+ endforeach()
+ set(RunCMake_TEST_SOURCE_DIR "${top_src}")
+ set(RunCMake_TEST_BINARY_DIR "${top_bin}/${test}-build")
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}"
+ -G "${RunCMake_GENERATOR}" -DRunCMake_TEST=${test}
+ WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}"
+ OUTPUT_VARIABLE actual_stdout
+ ERROR_VARIABLE actual_stderr
+ RESULT_VARIABLE actual_result
+ )
+ set(msg "")
+ if(NOT "${actual_result}" STREQUAL "${expect_result}")
+ set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n")
+ endif()
+ foreach(o out err)
+ string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}")
+ set(expect_${o} "")
+ if(DEFINED expect_std${o})
+ if(NOT "${actual_std${o}}" MATCHES "${expect_std${o}}")
+ string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o}
+ " expect-${o}> ${expect_std${o}}")
+ set(expect_${o} "Expected std${o} to match:\n${expect_${o}}\n")
+ set(msg "${msg}std${o} does not match that expected.\n")
+ endif()
+ endif()
+ endforeach()
+ unset(RunCMake_TEST_FAILED)
+ include(${top_src}/${test}-check.cmake OPTIONAL)
+ if(RunCMake_TEST_FAILED)
+ set(msg "${RunCMake_TEST_FAILED}\n${msg}")
+ endif()
+ if(msg)
+ string(REGEX REPLACE "\n" "\n actual-out> " actual_out " actual-out> ${actual_stdout}")
+ string(REGEX REPLACE "\n" "\n actual-err> " actual_err " actual-err> ${actual_stderr}")
+ message(SEND_ERROR "${test} - FAILED:\n"
+ "${msg}"
+ "${expect_out}"
+ "Actual stdout:\n${actual_out}\n"
+ "${expect_err}"
+ "Actual stderr:\n${actual_err}\n"
+ )
+ else()
+ message(STATUS "${test} - PASSED")
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/build_command/CMakeLists.txt b/Tests/RunCMake/build_command/CMakeLists.txt
new file mode 100644
index 000000000..0fbb94803
--- /dev/null
+++ b/Tests/RunCMake/build_command/CMakeLists.txt
@@ -0,0 +1,59 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
+
+# This CMakeLists file is *sometimes expected* to result in a configure error.
+#
+# expect this to succeed:
+# ../bin/Release/cmake -G Xcode
+# ../../CMake/Tests/CMakeCommands/build_command
+#
+# expect this to fail:
+# ../bin/Release/cmake -DTEST_ERROR_CONDITIONS:BOOL=ON -G Xcode
+# ../../CMake/Tests/CMakeCommands/build_command
+#
+# This project exists merely to test the CMake command 'build_command'...
+# ...even purposefully calling it with known-bad argument lists to cover
+# error handling code.
+#
+
+set(cmd "initial")
+
+message("0. begin")
+
+if(TEST_ERROR_CONDITIONS)
+ # Test with no arguments (an error):
+ build_command()
+ message("1. cmd='${cmd}'")
+
+ # Test with unknown arguments (also an error):
+ build_command(cmd BOGUS STUFF)
+ message("2. cmd='${cmd}'")
+
+ build_command(cmd STUFF BOGUS)
+ message("3. cmd='${cmd}'")
+else()
+ message("(skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF)")
+endif()
+
+# Test the one arg signature with none of the optional KEYWORD arguments:
+build_command(cmd)
+message("4. cmd='${cmd}'")
+
+# Test the two-arg legacy signature:
+build_command(legacy_cmd ${CMAKE_BUILD_TOOL})
+message("5. legacy_cmd='${legacy_cmd}'")
+message(" CMAKE_BUILD_TOOL='${CMAKE_BUILD_TOOL}'")
+
+# Test the optional KEYWORDs:
+build_command(cmd CONFIGURATION hoohaaConfig)
+message("6. cmd='${cmd}'")
+
+build_command(cmd PROJECT_NAME hoohaaProject)
+message("7. cmd='${cmd}'")
+
+build_command(cmd TARGET hoohaaTarget)
+message("8. cmd='${cmd}'")
+
+set(cmd "final")
+message("9. cmd='${cmd}'")
diff --git a/Tests/RunCMake/build_command/ErrorsOFF-stderr.txt b/Tests/RunCMake/build_command/ErrorsOFF-stderr.txt
new file mode 100644
index 000000000..331885b94
--- /dev/null
+++ b/Tests/RunCMake/build_command/ErrorsOFF-stderr.txt
@@ -0,0 +1 @@
+skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF
diff --git a/Tests/RunCMake/build_command/ErrorsOFF-stdout.txt b/Tests/RunCMake/build_command/ErrorsOFF-stdout.txt
new file mode 100644
index 000000000..cf66a9d7a
--- /dev/null
+++ b/Tests/RunCMake/build_command/ErrorsOFF-stdout.txt
@@ -0,0 +1 @@
+Build files have been written to:
diff --git a/Tests/RunCMake/build_command/ErrorsOFF.cmake b/Tests/RunCMake/build_command/ErrorsOFF.cmake
new file mode 100644
index 000000000..a243fab01
--- /dev/null
+++ b/Tests/RunCMake/build_command/ErrorsOFF.cmake
@@ -0,0 +1 @@
+set(TEST_ERROR_CONDITIONS OFF)
diff --git a/Tests/RunCMake/build_command/ErrorsON-result.txt b/Tests/RunCMake/build_command/ErrorsON-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/build_command/ErrorsON-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/build_command/ErrorsON-stderr.txt b/Tests/RunCMake/build_command/ErrorsON-stderr.txt
new file mode 100644
index 000000000..0be7475d7
--- /dev/null
+++ b/Tests/RunCMake/build_command/ErrorsON-stderr.txt
@@ -0,0 +1,12 @@
+CMake Error at CMakeLists.txt:[0-9]+ \(build_command\):
+ build_command requires at least one argument naming a CMake variable
+
++
+1. cmd='initial'
+CMake Error at CMakeLists.txt:[0-9]+ \(build_command\):
+ build_command unknown argument "BOGUS"
+
++
+2. cmd='initial'
+CMake Error at CMakeLists.txt:[0-9]+ \(build_command\):
+ build_command unknown argument "STUFF"
diff --git a/Tests/RunCMake/build_command/ErrorsON-stdout.txt b/Tests/RunCMake/build_command/ErrorsON-stdout.txt
new file mode 100644
index 000000000..841dd0d88
--- /dev/null
+++ b/Tests/RunCMake/build_command/ErrorsON-stdout.txt
@@ -0,0 +1 @@
+Configuring incomplete, errors occurred!
diff --git a/Tests/RunCMake/build_command/ErrorsON.cmake b/Tests/RunCMake/build_command/ErrorsON.cmake
new file mode 100644
index 000000000..27814bf64
--- /dev/null
+++ b/Tests/RunCMake/build_command/ErrorsON.cmake
@@ -0,0 +1 @@
+set(TEST_ERROR_CONDITIONS ON)
diff --git a/Tests/RunCMake/build_command/RunCMakeTest.cmake b/Tests/RunCMake/build_command/RunCMakeTest.cmake
new file mode 100644
index 000000000..4525c5725
--- /dev/null
+++ b/Tests/RunCMake/build_command/RunCMakeTest.cmake
@@ -0,0 +1,4 @@
+include(RunCMake)
+
+run_cmake(ErrorsOFF)
+run_cmake(ErrorsON)
diff --git a/Tests/RunCMake/find_package/CMakeLists.txt b/Tests/RunCMake/find_package/CMakeLists.txt
new file mode 100644
index 000000000..e8db6b05b
--- /dev/null
+++ b/Tests/RunCMake/find_package/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/find_package/ComponentRequiredAndOptional-result.txt b/Tests/RunCMake/find_package/ComponentRequiredAndOptional-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_package/ComponentRequiredAndOptional-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/ComponentRequiredAndOptional-stderr.txt b/Tests/RunCMake/find_package/ComponentRequiredAndOptional-stderr.txt
new file mode 100644
index 000000000..db8f51222
--- /dev/null
+++ b/Tests/RunCMake/find_package/ComponentRequiredAndOptional-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at ComponentRequiredAndOptional.cmake:1 \(find_package\):
+ find_package called with components that are both required and optional:
+
+ CompA
+ CompB
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/ComponentRequiredAndOptional.cmake b/Tests/RunCMake/find_package/ComponentRequiredAndOptional.cmake
new file mode 100644
index 000000000..0355f5af3
--- /dev/null
+++ b/Tests/RunCMake/find_package/ComponentRequiredAndOptional.cmake
@@ -0,0 +1 @@
+find_package(NotHere REQUIRED CompA CompB CompC OPTIONAL_COMPONENTS CompA CompB CompD)
diff --git a/Tests/RunCMake/find_package/MissingConfig-stderr.txt b/Tests/RunCMake/find_package/MissingConfig-stderr.txt
new file mode 100644
index 000000000..1eae0bb0b
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfig-stderr.txt
@@ -0,0 +1,19 @@
+CMake Warning at MissingConfig.cmake:1 \(find_package\):
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Warning at MissingConfig.cmake:2 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingConfig.cmake b/Tests/RunCMake/find_package/MissingConfig.cmake
new file mode 100644
index 000000000..238e7e498
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfig.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere CONFIG)
+message(WARNING "This warning must be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt b/Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt
new file mode 100644
index 000000000..10e71faa3
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning at MissingConfigOneName.cmake:1 \(find_package\):
+ Could not find a package configuration file named "NotHereConfig.cmake"
+ provided by package "NotHere".
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/MissingConfigOneName.cmake b/Tests/RunCMake/find_package/MissingConfigOneName.cmake
new file mode 100644
index 000000000..11676a9ab
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigOneName.cmake
@@ -0,0 +1 @@
+find_package(NotHere CONFIGS NotHereConfig.cmake)
diff --git a/Tests/RunCMake/find_package/MissingConfigRequired-result.txt b/Tests/RunCMake/find_package/MissingConfigRequired-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigRequired-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt b/Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt
new file mode 100644
index 000000000..2ba774aa2
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt
@@ -0,0 +1,13 @@
+CMake Error at MissingConfigRequired.cmake:1 \(find_package\):
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingConfigRequired.cmake b/Tests/RunCMake/find_package/MissingConfigRequired.cmake
new file mode 100644
index 000000000..0ae67023a
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigRequired.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere CONFIG REQUIRED)
+message(FATAL_ERROR "This error must not be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt b/Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt
new file mode 100644
index 000000000..2f5086ea8
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt
@@ -0,0 +1,13 @@
+CMake Warning at MissingConfigVersion.cmake:1 \(find_package\):
+ Could not find a package configuration file provided by "NotHere"
+ \(requested version 1\.2\) with any of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/MissingConfigVersion.cmake b/Tests/RunCMake/find_package/MissingConfigVersion.cmake
new file mode 100644
index 000000000..ac35a79e4
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigVersion.cmake
@@ -0,0 +1 @@
+find_package(NotHere 1.2 CONFIG)
diff --git a/Tests/RunCMake/find_package/MissingModule-stderr.txt b/Tests/RunCMake/find_package/MissingModule-stderr.txt
new file mode 100644
index 000000000..2ad460f58
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingModule-stderr.txt
@@ -0,0 +1,26 @@
+CMake Warning at MissingModule.cmake:1 \(find_package\):
+ No "FindNotHere.cmake" found in CMAKE_MODULE_PATH.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Warning \(dev\) at MissingModule.cmake:1 \(find_package\):
+ FindNotHere.cmake must either be part of this project itself, in this case
+ adjust CMAKE_MODULE_PATH so that it points to the correct location inside
+ its source tree.
+
+ Or it must be installed by a package which has already been found via
+ find_package\(\). In this case make sure that package has indeed been found
+ and adjust CMAKE_MODULE_PATH to contain the location where that package has
+ installed FindNotHere.cmake. This must be a location provided by that
+ package. This error in general means that the buildsystem of this project
+ is relying on a Find-module without ensuring that it is actually available.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning at MissingModule.cmake:2 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingModule.cmake b/Tests/RunCMake/find_package/MissingModule.cmake
new file mode 100644
index 000000000..76bcef293
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingModule.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere MODULE)
+message(WARNING "This warning must be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingModuleRequired-result.txt b/Tests/RunCMake/find_package/MissingModuleRequired-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingModuleRequired-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt b/Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt
new file mode 100644
index 000000000..fec05f183
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt
@@ -0,0 +1,21 @@
+CMake Error at MissingModuleRequired.cmake:1 \(find_package\):
+ No "FindNotHere.cmake" found in CMAKE_MODULE_PATH.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Warning \(dev\) at MissingModuleRequired.cmake:1 \(find_package\):
+ FindNotHere.cmake must either be part of this project itself, in this case
+ adjust CMAKE_MODULE_PATH so that it points to the correct location inside
+ its source tree.
+
+ Or it must be installed by a package which has already been found via
+ find_package\(\). In this case make sure that package has indeed been found
+ and adjust CMAKE_MODULE_PATH to contain the location where that package has
+ installed FindNotHere.cmake. This must be a location provided by that
+ package. This error in general means that the buildsystem of this project
+ is relying on a Find-module without ensuring that it is actually available.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/find_package/MissingModuleRequired.cmake b/Tests/RunCMake/find_package/MissingModuleRequired.cmake
new file mode 100644
index 000000000..897eda688
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingModuleRequired.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere MODULE REQUIRED)
+message(FATAL_ERROR "This error must not be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingNormal-stderr.txt b/Tests/RunCMake/find_package/MissingNormal-stderr.txt
new file mode 100644
index 000000000..f4c6fbafd
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormal-stderr.txt
@@ -0,0 +1,23 @@
+CMake Warning at MissingNormal.cmake:1 \(find_package\):
+ By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has
+ asked CMake to find a package configuration file provided by "NotHere", but
+ CMake did not find one.
+
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Warning at MissingNormal.cmake:2 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingNormal.cmake b/Tests/RunCMake/find_package/MissingNormal.cmake
new file mode 100644
index 000000000..fb90e0128
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormal.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere)
+message(WARNING "This warning must be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingNormalRequired-result.txt b/Tests/RunCMake/find_package/MissingNormalRequired-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalRequired-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt b/Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt
new file mode 100644
index 000000000..7bb7902b6
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt
@@ -0,0 +1,17 @@
+CMake Error at MissingNormalRequired.cmake:1 \(find_package\):
+ By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has
+ asked CMake to find a package configuration file provided by "NotHere", but
+ CMake did not find one.
+
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingNormalRequired.cmake b/Tests/RunCMake/find_package/MissingNormalRequired.cmake
new file mode 100644
index 000000000..33353d8cd
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalRequired.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere REQUIRED)
+message(FATAL_ERROR "This error must not be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt b/Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt
new file mode 100644
index 000000000..36de8009e
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt
@@ -0,0 +1,17 @@
+CMake Warning at MissingNormalVersion.cmake:1 \(find_package\):
+ By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has
+ asked CMake to find a package configuration file provided by "NotHere", but
+ CMake did not find one.
+
+ Could not find a package configuration file provided by "NotHere"
+ \(requested version 1\.2\) with any of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/MissingNormalVersion.cmake b/Tests/RunCMake/find_package/MissingNormalVersion.cmake
new file mode 100644
index 000000000..2d9ce4ea5
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalVersion.cmake
@@ -0,0 +1 @@
+find_package(NotHere 1.2)
diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt
new file mode 100644
index 000000000..d34f23c8f
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt
@@ -0,0 +1,30 @@
+CMake Warning \(dev\) at MissingNormalWarnNoModuleNew.cmake:3 \(find_package\):
+ find_package called without either MODULE or CONFIG option and no
+ FindNotHere.cmake module is in CMAKE_MODULE_PATH. Add MODULE to
+ exclusively request Module mode and fail if FindNotHere.cmake is missing.
+ Add CONFIG to exclusively request Config mode and search for a package
+ configuration file provided by NotHere \(NotHereConfig.cmake or
+ nothere-config.cmake\).
+
+ \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\)
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning at MissingNormalWarnNoModuleNew.cmake:3 \(find_package\):
+ By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has
+ asked CMake to find a package configuration file provided by "NotHere", but
+ CMake did not find one.
+
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake
new file mode 100644
index 000000000..0211249c6
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_FIND_PACKAGE_WARN_NO_MODULE 1)
+set(CMAKE_MINIMUM_REQUIRED_VERSION 2.8.8)
+find_package(NotHere)
diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt
new file mode 100644
index 000000000..b336b5621
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt
@@ -0,0 +1,29 @@
+CMake Warning \(dev\) at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\):
+ find_package called without NO_MODULE option and no FindNotHere.cmake
+ module is in CMAKE_MODULE_PATH. Add NO_MODULE to exclusively request
+ Config mode and search for a package configuration file provided by NotHere
+ \(NotHereConfig.cmake or nothere-config.cmake\). Otherwise make
+ FindNotHere.cmake available in CMAKE_MODULE_PATH.
+
+ \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\)
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\):
+ By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has
+ asked CMake to find a package configuration file provided by "NotHere", but
+ CMake did not find one.
+
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake
new file mode 100644
index 000000000..1c4a77599
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_FIND_PACKAGE_WARN_NO_MODULE 1)
+find_package(NotHere)
diff --git a/Tests/RunCMake/find_package/MixedModeOptions-result.txt b/Tests/RunCMake/find_package/MixedModeOptions-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_package/MixedModeOptions-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/MixedModeOptions-stderr.txt b/Tests/RunCMake/find_package/MixedModeOptions-stderr.txt
new file mode 100644
index 000000000..b8670221b
--- /dev/null
+++ b/Tests/RunCMake/find_package/MixedModeOptions-stderr.txt
@@ -0,0 +1,14 @@
+CMake Error at MixedModeOptions.cmake:1 \(find_package\):
+ find_package given options exclusive to Module mode:
+
+ MODULE
+
+ and options exclusive to Config mode:
+
+ CONFIG
+ CONFIGS
+ NO_DEFAULT_PATH
+
+ The options are incompatible.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/MixedModeOptions.cmake b/Tests/RunCMake/find_package/MixedModeOptions.cmake
new file mode 100644
index 000000000..7f78ee05f
--- /dev/null
+++ b/Tests/RunCMake/find_package/MixedModeOptions.cmake
@@ -0,0 +1 @@
+find_package(NotHere MODULE CONFIG CONFIGS NotHereConfig.cmake NO_DEFAULT_PATH)
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
new file mode 100644
index 000000000..42705b77a
--- /dev/null
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -0,0 +1,16 @@
+include(RunCMake)
+
+run_cmake(ComponentRequiredAndOptional)
+run_cmake(MissingNormal)
+run_cmake(MissingNormalRequired)
+run_cmake(MissingNormalVersion)
+run_cmake(MissingNormalWarnNoModuleOld)
+run_cmake(MissingNormalWarnNoModuleNew)
+run_cmake(MissingModule)
+run_cmake(MissingModuleRequired)
+run_cmake(MissingConfig)
+run_cmake(MissingConfigOneName)
+run_cmake(MissingConfigRequired)
+run_cmake(MissingConfigVersion)
+run_cmake(MixedModeOptions)
+run_cmake(SetFoundFALSE)
diff --git a/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt b/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt
new file mode 100644
index 000000000..695f6450d
--- /dev/null
+++ b/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning at SetFoundFALSE.cmake:2 \(find_package\):
+ Found package configuration file:
+
+ .*/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake
+
+ but it set SetFoundFALSE_FOUND to FALSE so package "SetFoundFALSE" is
+ considered to be NOT FOUND.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/SetFoundFALSE.cmake b/Tests/RunCMake/find_package/SetFoundFALSE.cmake
new file mode 100644
index 000000000..fbcec3c56
--- /dev/null
+++ b/Tests/RunCMake/find_package/SetFoundFALSE.cmake
@@ -0,0 +1,2 @@
+set(SetFoundFALSE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+find_package(SetFoundFALSE CONFIG)
diff --git a/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake b/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake
new file mode 100644
index 000000000..ae6bd1454
--- /dev/null
+++ b/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake
@@ -0,0 +1 @@
+set(SetFoundFALSE_FOUND FALSE)
diff --git a/Tests/RunCMake/include/CMakeLists.txt b/Tests/RunCMake/include/CMakeLists.txt
new file mode 100644
index 000000000..e8db6b05b
--- /dev/null
+++ b/Tests/RunCMake/include/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/include/EmptyString-stderr.txt b/Tests/RunCMake/include/EmptyString-stderr.txt
new file mode 100644
index 000000000..006c647c6
--- /dev/null
+++ b/Tests/RunCMake/include/EmptyString-stderr.txt
@@ -0,0 +1,5 @@
+CMake Warning \(dev\) at EmptyString.cmake:1 \(include\):
+ include\(\) given empty file name \(ignored\).
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/include/EmptyString.cmake b/Tests/RunCMake/include/EmptyString.cmake
new file mode 100644
index 000000000..4285cb3d5
--- /dev/null
+++ b/Tests/RunCMake/include/EmptyString.cmake
@@ -0,0 +1 @@
+include("")
diff --git a/Tests/RunCMake/include/EmptyStringOptional-stderr.txt b/Tests/RunCMake/include/EmptyStringOptional-stderr.txt
new file mode 100644
index 000000000..b61c67912
--- /dev/null
+++ b/Tests/RunCMake/include/EmptyStringOptional-stderr.txt
@@ -0,0 +1,5 @@
+CMake Warning \(dev\) at EmptyStringOptional.cmake:1 \(include\):
+ include\(\) given empty file name \(ignored\).
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/include/EmptyStringOptional.cmake b/Tests/RunCMake/include/EmptyStringOptional.cmake
new file mode 100644
index 000000000..549d46b3d
--- /dev/null
+++ b/Tests/RunCMake/include/EmptyStringOptional.cmake
@@ -0,0 +1 @@
+include("" OPTIONAL)
diff --git a/Tests/RunCMake/include/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake
new file mode 100644
index 000000000..59b87ca75
--- /dev/null
+++ b/Tests/RunCMake/include/RunCMakeTest.cmake
@@ -0,0 +1,4 @@
+include(RunCMake)
+
+run_cmake(EmptyString)
+run_cmake(EmptyStringOptional)
diff --git a/Tests/RunCMake/include_external_msproject/CMakeLists.txt b/Tests/RunCMake/include_external_msproject/CMakeLists.txt
new file mode 100644
index 000000000..e8db6b05b
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/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/include_external_msproject/CustomGuid-check.cmake b/Tests/RunCMake/include_external_msproject/CustomGuid-check.cmake
new file mode 100644
index 000000000..68dec4c08
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/CustomGuid-check.cmake
@@ -0,0 +1 @@
+check_project(CustomGuid external "aaa-bbb-ccc-000" "" "")
diff --git a/Tests/RunCMake/include_external_msproject/CustomGuid.cmake b/Tests/RunCMake/include_external_msproject/CustomGuid.cmake
new file mode 100644
index 000000000..1dbe7da05
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/CustomGuid.cmake
@@ -0,0 +1,2 @@
+include_external_msproject(external external.project
+ GUID aaa-bbb-ccc-000)
diff --git a/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check.cmake b/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check.cmake
new file mode 100644
index 000000000..614712ee6
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check.cmake
@@ -0,0 +1 @@
+check_project(CustomGuidTypePlatform external "aaa-bbb-ccc-111" "aaa-bbb-ccc-ddd-eee" "Custom Platform")
diff --git a/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform.cmake b/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform.cmake
new file mode 100644
index 000000000..ee4db655f
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform.cmake
@@ -0,0 +1,5 @@
+# Test all optional parameters are set.
+include_external_msproject(external external.project
+ GUID aaa-bbb-ccc-111
+ TYPE aaa-bbb-ccc-ddd-eee
+ PLATFORM "Custom Platform")
diff --git a/Tests/RunCMake/include_external_msproject/CustomTypePlatform-check.cmake b/Tests/RunCMake/include_external_msproject/CustomTypePlatform-check.cmake
new file mode 100644
index 000000000..054eeb037
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/CustomTypePlatform-check.cmake
@@ -0,0 +1 @@
+check_project(CustomTypePlatform external "" "aaa-bbb-ccc-ddd-eee" "Custom Platform")
diff --git a/Tests/RunCMake/include_external_msproject/CustomTypePlatform.cmake b/Tests/RunCMake/include_external_msproject/CustomTypePlatform.cmake
new file mode 100644
index 000000000..8c76adbc8
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/CustomTypePlatform.cmake
@@ -0,0 +1,3 @@
+include_external_msproject(external external.project
+ TYPE aaa-bbb-ccc-ddd-eee
+ PLATFORM "Custom Platform")
diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
new file mode 100644
index 000000000..90710f9bf
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+include(${CMAKE_CURRENT_LIST_DIR}/check_utils.cmake)
+
+run_cmake(CustomGuid)
+run_cmake(CustomTypePlatform)
+run_cmake(CustomGuidTypePlatform)
diff --git a/Tests/RunCMake/include_external_msproject/check_utils.cmake b/Tests/RunCMake/include_external_msproject/check_utils.cmake
new file mode 100644
index 000000000..7d6b8f8ea
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/check_utils.cmake
@@ -0,0 +1,109 @@
+# Check that file contains line that matches regular expression.
+# Sets IS_FOUND variable to TRUE if found and to FALSE otherwise.
+macro(check_line_exists TARGET_FILE REG_EXP_REF)
+ set(IS_FOUND "FALSE")
+
+ file(STRINGS ${TARGET_FILE} FOUND_LINE LIMIT_COUNT 1 REGEX "${${REG_EXP_REF}}")
+ list(LENGTH FOUND_LINE _VAR_LEN)
+
+ if(_VAR_LEN GREATER 0)
+ set(IS_FOUND "TRUE")
+ endif(_VAR_LEN GREATER 0)
+endmacro(check_line_exists TARGET_FILE REG_EXP_REF)
+
+# Search and parse project section line by project name.
+# If search was successful stores found type and guid into FOUND_TYPE and FOUND_GUID variables respectively.
+# Sets IS_FOUND variable to TRUE if found and to FALSE otherwise.
+macro(parse_project_section TARGET_FILE PROJECT_NAME)
+ set(REG_EXP "^Project\\(\\\"{(.+)}\\\"\\) = \\\"${PROJECT_NAME}\\\", \\\".+\\..+\\\", \\\"{(.+)}\\\"$")
+
+ check_line_exists(${TARGET_FILE} REG_EXP)
+ if(NOT IS_FOUND)
+ return()
+ endif(NOT IS_FOUND)
+
+ string(REGEX REPLACE "${REG_EXP}" "\\1;\\2" _GUIDS "${FOUND_LINE}")
+
+ list(GET _GUIDS 0 FOUND_TYPE)
+ list(GET _GUIDS 1 FOUND_GUID)
+endmacro(parse_project_section TARGET_FILE PROJECT_NAME)
+
+# Search project section line by project name and type.
+# Returns TRUE if found and FALSE otherwise
+function(check_project_type TARGET_FILE PROJECT_NAME PROJECT_TYPE RESULT)
+ set(${RESULT} "FALSE" PARENT_SCOPE)
+
+ parse_project_section(${TARGET_FILE} ${PROJECT_NAME})
+ if(IS_FOUND AND FOUND_TYPE STREQUAL PROJECT_TYPE)
+ set(${RESULT} "TRUE" PARENT_SCOPE)
+ endif(IS_FOUND AND FOUND_TYPE STREQUAL PROJECT_TYPE)
+endfunction(check_project_type TARGET_FILE PROJECT_NAME PROJECT_TYPE RESULT)
+
+
+# Search project section line by project name and id.
+# Returns TRUE if found and FALSE otherwise
+function(check_project_guid TARGET_FILE PROJECT_NAME PROJECT_GUID RESULT)
+ set(${RESULT} "FALSE" PARENT_SCOPE)
+
+ parse_project_section(${TARGET_FILE} ${PROJECT_NAME})
+ if(IS_FOUND AND FOUND_GUID STREQUAL PROJECT_GUID)
+ set(${RESULT} "TRUE" PARENT_SCOPE)
+ endif(IS_FOUND AND FOUND_GUID STREQUAL PROJECT_GUID)
+endfunction(check_project_guid TARGET_FILE PROJECT_NAME PROJECT_GUID RESULT)
+
+
+# Search project's build configuration line by project name and target platform name.
+# Returns TRUE if found and FALSE otherwise
+function(check_custom_platform TARGET_FILE PROJECT_NAME PLATFORM_NAME RESULT)
+ set(${RESULT} "FALSE" PARENT_SCOPE)
+
+ # extract project guid
+ parse_project_section(${TARGET_FILE} ${PROJECT_NAME})
+ if(NOT IS_FOUND)
+ return()
+ endif(NOT IS_FOUND)
+
+ # probably whould be better to use configuration name
+ # extracted from CMAKE_CONFIGURATION_TYPES than just hardcoded "Debug" instead
+ set(REG_EXP "^(\t)*\\{${FOUND_GUID}\\}\\.Debug[^ ]*\\.ActiveCfg = Debug\\|${PLATFORM_NAME}$")
+ check_line_exists(${TARGET_FILE} REG_EXP)
+
+ set(${RESULT} ${IS_FOUND} PARENT_SCOPE)
+endfunction(check_custom_platform TARGET_FILE PLATFORM_NAME RESULT)
+
+# RunCMake test check helper
+function(check_project test name guid type platform)
+ set(sln "${RunCMake_TEST_BINARY_DIR}/${test}.sln")
+ set(sep "")
+ set(failed "")
+ if(NOT type)
+ set(type 8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942)
+ endif()
+ if(NOT platform)
+ if("${RunCMake_GENERATOR}" MATCHES "Win64")
+ set(platform "x64")
+ else()
+ set(platform "Win32")
+ endif()
+ endif()
+ if(guid)
+ check_project_guid("${sln}" "${name}" "${guid}" passed_guid)
+ if(NOT passed_guid)
+ set(failed "${failed}${sep}${name} solution has no project with expected GUID=${guid}")
+ set(sep "\n")
+ endif()
+ else()
+ set(passed_guid 1)
+ endif()
+ check_project_type("${sln}" "${name}" "${type}" passed_type)
+ if(NOT passed_type)
+ set(failed "${failed}${sep}${name} solution has no project with expected TYPE=${type}")
+ set(sep "\n")
+ endif()
+ check_custom_platform("${sln}" "${name}" "${platform}" passed_platform)
+ if(NOT passed_platform)
+ set(failed "${failed}${sep}${name} solution has no project with expected PLATFORM=${platform}")
+ set(sep "\n")
+ endif()
+ set(RunCMake_TEST_FAILED "${failed}" PARENT_SCOPE)
+endfunction()
diff --git a/Tests/RunCMake/include_external_msproject/main.cpp b/Tests/RunCMake/include_external_msproject/main.cpp
new file mode 100644
index 000000000..919810306
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/main.cpp
@@ -0,0 +1,3 @@
+void main()
+{
+}
diff --git a/Tests/RunCMake/list/CMakeLists.txt b/Tests/RunCMake/list/CMakeLists.txt
new file mode 100644
index 000000000..e8db6b05b
--- /dev/null
+++ b/Tests/RunCMake/list/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/list/EmptyGet0-result.txt b/Tests/RunCMake/list/EmptyGet0-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/EmptyGet0-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/EmptyGet0-stderr.txt b/Tests/RunCMake/list/EmptyGet0-stderr.txt
new file mode 100644
index 000000000..0c61b011f
--- /dev/null
+++ b/Tests/RunCMake/list/EmptyGet0-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at EmptyGet0.cmake:2 \(list\):
+ list GET given empty list
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/EmptyGet0.cmake b/Tests/RunCMake/list/EmptyGet0.cmake
new file mode 100644
index 000000000..494710825
--- /dev/null
+++ b/Tests/RunCMake/list/EmptyGet0.cmake
@@ -0,0 +1,2 @@
+set(mylist "")
+list(GET mylist 0 result)
diff --git a/Tests/RunCMake/list/EmptyInsert-1-result.txt b/Tests/RunCMake/list/EmptyInsert-1-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/EmptyInsert-1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/EmptyInsert-1-stderr.txt b/Tests/RunCMake/list/EmptyInsert-1-stderr.txt
new file mode 100644
index 000000000..0900ff941
--- /dev/null
+++ b/Tests/RunCMake/list/EmptyInsert-1-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at EmptyInsert-1.cmake:2 \(list\):
+ list index: -1 out of range \(0, 0\)
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/EmptyInsert-1.cmake b/Tests/RunCMake/list/EmptyInsert-1.cmake
new file mode 100644
index 000000000..140da5d07
--- /dev/null
+++ b/Tests/RunCMake/list/EmptyInsert-1.cmake
@@ -0,0 +1,2 @@
+set(mylist "")
+list(INSERT mylist -1 x)
diff --git a/Tests/RunCMake/list/EmptyRemoveAt0-result.txt b/Tests/RunCMake/list/EmptyRemoveAt0-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/EmptyRemoveAt0-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/EmptyRemoveAt0-stderr.txt b/Tests/RunCMake/list/EmptyRemoveAt0-stderr.txt
new file mode 100644
index 000000000..b24a0ed0b
--- /dev/null
+++ b/Tests/RunCMake/list/EmptyRemoveAt0-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at EmptyRemoveAt0.cmake:2 \(list\):
+ list REMOVE_AT given empty list
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/EmptyRemoveAt0.cmake b/Tests/RunCMake/list/EmptyRemoveAt0.cmake
new file mode 100644
index 000000000..d6a3e85c6
--- /dev/null
+++ b/Tests/RunCMake/list/EmptyRemoveAt0.cmake
@@ -0,0 +1,2 @@
+set(mylist "")
+list(REMOVE_AT mylist 0)
diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake
new file mode 100644
index 000000000..555051de0
--- /dev/null
+++ b/Tests/RunCMake/list/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(EmptyGet0)
+run_cmake(EmptyRemoveAt0)
+run_cmake(EmptyInsert-1)