aboutsummaryrefslogtreecommitdiff
path: root/modules-tests/TestFindPackage.cmake
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2008-11-14 20:45:30 +0000
committerAlexander Neundorf <neundorf@kde.org>2008-11-14 20:45:30 +0000
commitde54277a5fca412232a166928233861106c99f7a (patch)
treeaf211ecbc650824be6d353b0939f13b2460c4db7 /modules-tests/TestFindPackage.cmake
parentedbb4a8a70a894c46be88fa9cb7ef38a6032fcc1 (diff)
downloadextra-cmake-modules-de54277a5fca412232a166928233861106c99f7a.tar.gz
extra-cmake-modules-de54277a5fca412232a166928233861106c99f7a.tar.bz2
-add a test for FindQCA2.cmake
-add a macro test_find_package(<package> <prefix> <var_without_prefix1>...<var_without_prefixN>) for executing a mdoule and printing the results -add cmake script RunAllModuleTests.cmake which can be used to run all existing tests in one go Alex svn path=/trunk/KDE/kdelibs/; revision=884395
Diffstat (limited to 'modules-tests/TestFindPackage.cmake')
-rw-r--r--modules-tests/TestFindPackage.cmake35
1 files changed, 35 insertions, 0 deletions
diff --git a/modules-tests/TestFindPackage.cmake b/modules-tests/TestFindPackage.cmake
new file mode 100644
index 00000000..1a1bf8fe
--- /dev/null
+++ b/modules-tests/TestFindPackage.cmake
@@ -0,0 +1,35 @@
+# This module provides the macro TEST_FIND_PACKAGE()
+#
+# TEST_FIND_PACKAGE(package prefix var1 .. varN )
+# It can be used to test a CMake Find-module.
+# It executes FIND_PACKAGE(<package>) and then prints some results.
+# <package> is the same as for FIND_PACKAGE() and
+# prefix should be the prefix which is used in that module for
+# all variables.
+# It checks <prefix>_FOUND to decide whether the module was successful or not.
+#
+# Example:
+# test_find_package(Xine XINE VERSION INCLUDE_DIR LIBRARY)
+#
+# This will check XINE_FOUND and then print the variables XINE_VERSION, XINE_INCLUDE_DIR and XINE_LIBRARY.
+
+cmake_minimum_required(VERSION 2.6.2)
+cmake_policy(SET CMP0000 OLD)
+
+macro(TEST_FIND_PACKAGE package prefix )
+ message(STATUS ">> ***** Testing Find${package}.cmake *****")
+ find_package(${package})
+ message(STATUS ">> ***** Results from Find${package}.cmake *****")
+
+ if ( ${prefix}_FOUND)
+ message(STATUS ">> Find${package}.cmake: ${package} has been found")
+ else ( ${prefix}_FOUND)
+ message(STATUS ">> Find${package}.cmake: ${package} has NOT been found !")
+ endif ( ${prefix}_FOUND)
+
+ message(STATUS "${prefix}_FOUND: \"${${prefix}_FOUND}\"")
+ foreach(var ${ARGN})
+ message(STATUS ">> ${prefix}_${var}: \"${${prefix}_${var}}\"")
+ endforeach(var)
+ message(STATUS ">> ***** Done *****")
+endmacro(TEST_FIND_PACKAGE package)