summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2008-06-16 18:03:03 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2008-06-16 18:03:03 (GMT)
commit8ef9983db697f2e96e930f72c72686cd4e106ff6 (patch)
treef76e3265f0f018f81e4927cbf9dbec0bae634f97 /Tests
parentd1c1d8025ffc9ad3bcfc43d4586b34b9cd54bf34 (diff)
downloadCMake-8ef9983db697f2e96e930f72c72686cd4e106ff6.zip
CMake-8ef9983db697f2e96e930f72c72686cd4e106ff6.tar.gz
CMake-8ef9983db697f2e96e930f72c72686cd4e106ff6.tar.bz2
ENH: add test which executes all FindXXX.cmake modules
Alex
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/FindModulesExecuteAll/CMakeLists.txt29
-rw-r--r--Tests/FindModulesExecuteAll/main.c4
3 files changed, 34 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 0af70f7..03d50fb 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -40,6 +40,7 @@ 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(FindModulesExecuteAll FindModulesExecuteAll)
ADD_TEST_MACRO(StringFileTest StringFileTest)
ADD_TEST_MACRO(TryCompile TryCompile)
ADD_TEST_MACRO(TarTest TarTest)
diff --git a/Tests/FindModulesExecuteAll/CMakeLists.txt b/Tests/FindModulesExecuteAll/CMakeLists.txt
new file mode 100644
index 0000000..c9a6d6c
--- /dev/null
+++ b/Tests/FindModulesExecuteAll/CMakeLists.txt
@@ -0,0 +1,29 @@
+# This file includes all FindXXX.cmake modules, so they are all executed.
+# As it is it doesn't test a lot.
+# It makes sure that the modules don't contain basic syntax errors.
+# It also makes sure that modules don't fail with an error if something
+# wasn't found but REQUIRED was not given.
+#
+# I guess more things could be added, like checking whether variables are
+# defined after running the modules (e.g. FOO_FOUND etc.).
+
+
+file(GLOB all_modules "${CMAKE_CURRENT_SOURCE_DIR}/../../Modules/Find*cmake")
+
+foreach(module ${all_modules})
+ message(STATUS "module: ${module}")
+ include("${module}")
+
+ # get the "basename" of the package, so the existence of variables like
+ # FOO_FOUND could be tested later on, Alex
+ string(REGEX REPLACE ".+Find([^\\.]+)\\.cmake" "\\1" packageName "${module}")
+ string(TOUPPER "${packageName}" packageNameUpper)
+
+# disabled for now, since too many modules break:
+# if(NOT DEFINED ${packageNameUpper}_FOUND)
+# message(SEND_ERROR "${packageNameUpper}_FOUND not defined !")
+# endif(NOT DEFINED ${packageNameUpper}_FOUND)
+
+endforeach(module ${all_modules})
+
+add_executable(FindModulesExecuteAll main.c)
diff --git a/Tests/FindModulesExecuteAll/main.c b/Tests/FindModulesExecuteAll/main.c
new file mode 100644
index 0000000..c13815c
--- /dev/null
+++ b/Tests/FindModulesExecuteAll/main.c
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}