summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2013-02-20 18:35:11 (GMT)
committerBrad King <brad.king@kitware.com>2013-02-22 13:31:00 (GMT)
commit7bb1abe56a05ccc50ff2c56e2df60f305af17ca4 (patch)
tree89ed15067444ce611b43d6a297586becaa9b7b78 /Tests
parentf7029572ca5948ff87ba0c6e8aaff35f6fdab4f1 (diff)
downloadCMake-7bb1abe56a05ccc50ff2c56e2df60f305af17ca4.zip
CMake-7bb1abe56a05ccc50ff2c56e2df60f305af17ca4.tar.gz
CMake-7bb1abe56a05ccc50ff2c56e2df60f305af17ca4.tar.bz2
FPHSA: Add FOUND_VAR option to specify _FOUND variable name
In the new mode FPHSA now accepts a FOUND_VAR option, which can be set either to ExactCase_FOUND or UPPERCASE_FOUND, no other values are accepted. Also add tests for that, including failure. Alex
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt3
-rw-r--r--Tests/FPHSA_InvalidFOUND_VAR/CMakeLists.txt5
-rw-r--r--Tests/FPHSA_InvalidFOUND_VAR/FindBadFoundVar.cmake6
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt10
-rw-r--r--Tests/FindPackageTest/FindSomePackage.cmake6
-rw-r--r--Tests/FindPackageTest/FindUpperCasePackage.cmake6
6 files changed, 36 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index f8e4afd..2725202 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -147,6 +147,9 @@ if(BUILD_TESTING)
# add a bunch of standard build-and-test style tests
ADD_TEST_MACRO(CommandLineTest CommandLineTest)
ADD_TEST_MACRO(FindPackageTest FindPackageTest)
+ ADD_TEST_MACRO(FPHSA_InvalidFOUND_VAR FPHSA_InvalidFOUND_VAR)
+ set_tests_properties(FPHSA_InvalidFOUND_VAR PROPERTIES
+ PASS_REGULAR_EXPRESSION "The argument for FOUND_VAR is .badfoundvar_FOUND., but only")
ADD_TEST_MACRO(FindModulesExecuteAll FindModulesExecuteAll)
ADD_TEST_MACRO(StringFileTest StringFileTest)
ADD_TEST_MACRO(TryCompile TryCompile)
diff --git a/Tests/FPHSA_InvalidFOUND_VAR/CMakeLists.txt b/Tests/FPHSA_InvalidFOUND_VAR/CMakeLists.txt
new file mode 100644
index 0000000..6a88cf5
--- /dev/null
+++ b/Tests/FPHSA_InvalidFOUND_VAR/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8)
+
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+find_package(BadFoundVar REQUIRED)
diff --git a/Tests/FPHSA_InvalidFOUND_VAR/FindBadFoundVar.cmake b/Tests/FPHSA_InvalidFOUND_VAR/FindBadFoundVar.cmake
new file mode 100644
index 0000000..152df5c
--- /dev/null
+++ b/Tests/FPHSA_InvalidFOUND_VAR/FindBadFoundVar.cmake
@@ -0,0 +1,6 @@
+set(BFV_FOO TRUE)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(BadFoundVar REQUIRED_VARS BFV_FOO
+ FOUND_VAR badfoundvar_FOUND )
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index bca149b..a77713f 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -43,6 +43,16 @@ if(NOT LOTSOFCOMPONENTS_FOUND)
message(SEND_ERROR "LotsOfComponents not found !")
endif()
+find_package(SomePackage)
+if(NOT SomePackage_FOUND)
+ message(SEND_ERROR "SomePackage with FOUND_VAR SomePackage_FOUND not found !")
+endif()
+
+find_package(UpperCasePackage)
+if(NOT UPPERCASEPACKAGE_FOUND)
+ message(SEND_ERROR "UpperCasePackage with FOUND_VAR UPPERCASEPACKAGE_FOUND not found !")
+endif()
+
#-----------------------------------------------------------------------------
# Test system package registry if possible.
set(CMakeTestSystemPackage "")
diff --git a/Tests/FindPackageTest/FindSomePackage.cmake b/Tests/FindPackageTest/FindSomePackage.cmake
new file mode 100644
index 0000000..83d1d0e
--- /dev/null
+++ b/Tests/FindPackageTest/FindSomePackage.cmake
@@ -0,0 +1,6 @@
+set(SOP_FOO TRUE)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(SomePackage REQUIRED_VARS SOP_FOO
+ FOUND_VAR SomePackage_FOUND )
diff --git a/Tests/FindPackageTest/FindUpperCasePackage.cmake b/Tests/FindPackageTest/FindUpperCasePackage.cmake
new file mode 100644
index 0000000..66c2fea
--- /dev/null
+++ b/Tests/FindPackageTest/FindUpperCasePackage.cmake
@@ -0,0 +1,6 @@
+set(UCP_FOO TRUE)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(UpperCasePackage REQUIRED_VARS UCP_FOO
+ FOUND_VAR UPPERCASEPACKAGE_FOUND )