From 9d72b25a861bdcc69bf08e7494884027c341f7c9 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 26 Jan 2012 22:10:31 +0100 Subject: CMakeOnly.AllFindModules: clean up the Qt3/Qt4 code --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 8a38f06..d28ac01 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -15,25 +15,25 @@ macro(do_find MODULE_NAME) find_package(${MODULE_NAME}) endmacro(do_find) +# It is only possible to use either Qt3 or Qt4 in one project. +# Since FindQt will complain if both are found we explicitely +# filter out this and FindQt3. FindKDE3 also depends on Qt3 and +# is therefore also blocked +set(NO_QT4_MODULES "Qt" "Qt3" "KDE3") + foreach(FIND_MODULE ${FIND_MODULES}) string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") - # It is only possible to use either Qt3 or Qt4 in one project. - # Since FindQt will complain if both are found we explicitely - # filter out this and FindQt3. FindKDE3 also depends on Qt3 and - # is therefore also blocked - - if (NOT MODULE_NAME STREQUAL "Qt" AND - NOT MODULE_NAME STREQUAL "Qt3" AND - NOT MODULE_NAME STREQUAL "KDE3") + list(FIND NO_QT4_MODULES ${MODULE_NAME} NO_QT4_INDEX) + if (NO_QT4_INDEX EQUAL -1) do_find(${MODULE_NAME}) endif () endforeach(FIND_MODULE) # Qt4 is not present, so we can check Qt3 -if(NOT QT4_FOUND) - foreach(FIND_MODULE "Qt3" "Qt" "KDE3") +if (NOT QT4_FOUND) + foreach(FIND_MODULE ${NO_QT4_MODULES}) do_find(${FIND_MODULE}) endforeach(FIND_MODULE) -endif(NOT QT4_FOUND) +endif (NOT QT4_FOUND) -- cgit v0.12 From 3c4b4fffd0a6739e8771e4d552d98d21d294a84b Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 26 Jan 2012 22:17:10 +0100 Subject: CMakeOnly.AllFindModules: always check FindQt --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index d28ac01..0c22e00 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -19,8 +19,9 @@ endmacro(do_find) # Since FindQt will complain if both are found we explicitely # filter out this and FindQt3. FindKDE3 also depends on Qt3 and # is therefore also blocked -set(NO_QT4_MODULES "Qt" "Qt3" "KDE3") +set(NO_QT4_MODULES "Qt3" "KDE3") +set(DESIRED_QT_VERSION 4) foreach(FIND_MODULE ${FIND_MODULES}) string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") @@ -33,7 +34,8 @@ endforeach(FIND_MODULE) # Qt4 is not present, so we can check Qt3 if (NOT QT4_FOUND) - foreach(FIND_MODULE ${NO_QT4_MODULES}) + set(DESIRED_QT_VERSION 3) + foreach(FIND_MODULE ${NO_QT4_MODULES} "Qt") do_find(${FIND_MODULE}) endforeach(FIND_MODULE) endif (NOT QT4_FOUND) -- cgit v0.12 From 2dee9294969ff5ef85a4dacb13de70b8a9de03db Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 26 Jan 2012 22:26:00 +0100 Subject: CMakeOnly.AllFindModules: suppress two modules from testing FindPackageHandleStandardArgs and FindPackageMessage match the glob expression but are nothing that will usually be fed into find_package(). --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 0c22e00..308177d 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -21,12 +21,17 @@ endmacro(do_find) # is therefore also blocked set(NO_QT4_MODULES "Qt3" "KDE3") +# These modules are named Find*.cmake, but are nothing that works in +# find_package(). +set(NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage") + set(DESIRED_QT_VERSION 4) foreach(FIND_MODULE ${FIND_MODULES}) string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") list(FIND NO_QT4_MODULES ${MODULE_NAME} NO_QT4_INDEX) - if (NO_QT4_INDEX EQUAL -1) + list(FIND NO_FIND_MODULES ${MODULE_NAME} NO_FIND_INDEX) + if (NO_QT4_INDEX EQUAL -1 AND NO_FIND_INDEX EQUAL -1) do_find(${MODULE_NAME}) endif () -- cgit v0.12 From ed1b12624dfe7f4b6afeb557aabb091904918bc7 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 30 Jan 2012 19:25:07 +0100 Subject: CMakeOnly.AllFindModules: require version for some modules --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 308177d..127e9d7 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -44,3 +44,25 @@ if (NOT QT4_FOUND) do_find(${FIND_MODULE}) endforeach(FIND_MODULE) endif (NOT QT4_FOUND) + +# If any of these modules reported that it was found a version number should have been +# reported. +set(VERSIONS_REQUIRED + ALSA BISON BZIP2 CUPS CURL DOXYGEN EXPAT FLEX GETTEXT GIF GIT GNUPLOT + ImageMagick JASPER LibArchive LIBXML2 PERL PostgreSQL SWIG TIFF ZLIB) + +foreach(VTEST ${VERSIONS_REQUIRED}) + if (${VTEST}_FOUND) + if (DEFINED ${VTEST}_VERSION_STRING) + if (NOT ${VTEST}_VERSION_STRING MATCHES "^[0-9][0-9\\.]*[A-Za-z_]*[0-9\\.]*$") + message(SEND_ERROR "${VTEST}_VERSION_STRING has unexpected content ${${VTEST}_VERSION_STRING}") + endif() + elseif (DEFINED ${VTEST}_VERSION) + if (NOT ${VTEST}_VERSION MATCHES "^[0-9][0-9\\.]*[A-Za-z_]*[0-9\\.]*$") + message(SEND_ERROR "${VTEST}_VERSION has unexpected content ${${VTEST}_VERSION}") + endif() + else() + message(SEND_ERROR "${VTEST}_FOUND is set but no version number is defined") + endif() + endif(${VTEST}_FOUND) +endforeach(VTEST) -- cgit v0.12