Hi, attached you can find a patch which adds a test named FindModulesExecuteAll to CMake/Tests/. It include()s all FindXXX.cmake files, so they are all executed. Right now this only ensures that the files can be executed by cmake and that they don't fail with FATAL_ERROR if they failed and REQUIRED was not used.
It could maybe be extended to check whether variables like FOO_FOUND are defined after the module has been executed. What do you think ? Is it worth committing ? Alex
Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/CMake/CMake/Tests/CMakeLists.txt,v retrieving revision 1.49 diff -b -u -p -r1.49 CMakeLists.txt --- CMakeLists.txt 19 Apr 2008 17:37:38 -0000 1.49 +++ CMakeLists.txt 14 Jun 2008 19:54:45 -0000 @@ -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) Index: FindModulesExecuteAll/CMakeLists.txt =================================================================== RCS file: FindModulesExecuteAll/CMakeLists.txt diff -N FindModulesExecuteAll/CMakeLists.txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ FindModulesExecuteAll/CMakeLists.txt 14 Jun 2008 19:54:45 -0000 @@ -0,0 +1,18 @@ +# 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}") +endforeach(module ${all_modules}) + +add_executable(FindModulesExecuteAll main.c) Index: FindModulesExecuteAll/main.c =================================================================== RCS file: FindModulesExecuteAll/main.c diff -N FindModulesExecuteAll/main.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ FindModulesExecuteAll/main.c 14 Jun 2008 19:54:45 -0000 @@ -0,0 +1,4 @@ +int main() +{ + return 0; +}
_______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake