2012-01-17 02:37:13 +04:00
|
|
|
cmake_minimum_required (VERSION 2.8)
|
|
|
|
project(AllFindModules)
|
|
|
|
|
|
|
|
if (POLICY CMP0017)
|
|
|
|
cmake_policy(SET CMP0017 NEW)
|
|
|
|
endif ()
|
|
|
|
|
2012-01-17 22:08:40 +04:00
|
|
|
# Avoid ctest truncation of output
|
|
|
|
message(STATUS "CTEST_FULL_OUTPUT")
|
|
|
|
|
2012-01-17 02:37:13 +04:00
|
|
|
file(GLOB FIND_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/Find*.cmake" )
|
|
|
|
|
2012-01-18 21:23:21 +04:00
|
|
|
macro(do_find MODULE_NAME)
|
|
|
|
message(STATUS " Checking Find${MODULE_NAME}")
|
|
|
|
find_package(${MODULE_NAME})
|
2012-08-13 21:50:14 +04:00
|
|
|
endmacro()
|
2012-01-18 21:23:21 +04:00
|
|
|
|
2012-01-27 01:10:31 +04:00
|
|
|
# It is only possible to use either Qt3 or Qt4 in one project.
|
2012-02-18 19:13:34 +04:00
|
|
|
# Since FindQt will complain if both are found we explicitly request Qt4 here
|
|
|
|
# and filter out FindQt3. FindKDE3 also depends on Qt3 and
|
2012-01-27 01:10:31 +04:00
|
|
|
# is therefore also blocked
|
2012-02-18 19:13:34 +04:00
|
|
|
set(DESIRED_QT_VERSION 4)
|
2012-01-27 01:17:10 +04:00
|
|
|
set(NO_QT4_MODULES "Qt3" "KDE3")
|
2012-01-27 01:10:31 +04:00
|
|
|
|
2013-08-09 22:34:29 +04:00
|
|
|
# ignore everything that has it's own test in Tests/Module/
|
|
|
|
file(GLOB OWN_TEST_MODULES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/../../Module/" "${CMAKE_CURRENT_SOURCE_DIR}/../../Module/Find*")
|
|
|
|
foreach(FIND_MODULE IN LISTS OWN_TEST_MODULES)
|
|
|
|
string(REGEX REPLACE "^Find" "" _MOD_NAME "${FIND_MODULE}")
|
|
|
|
list(APPEND NO_FIND_MODULES "${_MOD_NAME}")
|
|
|
|
endforeach()
|
|
|
|
|
2012-01-27 01:26:00 +04:00
|
|
|
# These modules are named Find*.cmake, but are nothing that works in
|
|
|
|
# find_package().
|
2013-08-09 22:34:29 +04:00
|
|
|
list(APPEND NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage")
|
2012-01-27 01:26:00 +04:00
|
|
|
|
2013-08-09 22:34:29 +04:00
|
|
|
foreach(FIND_MODULE IN LISTS FIND_MODULES)
|
2012-01-17 02:37:13 +04:00
|
|
|
string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}")
|
|
|
|
|
2012-01-27 01:10:31 +04:00
|
|
|
list(FIND NO_QT4_MODULES ${MODULE_NAME} NO_QT4_INDEX)
|
2012-01-27 01:26:00 +04:00
|
|
|
list(FIND NO_FIND_MODULES ${MODULE_NAME} NO_FIND_INDEX)
|
|
|
|
if (NO_QT4_INDEX EQUAL -1 AND NO_FIND_INDEX EQUAL -1)
|
2012-01-18 21:23:21 +04:00
|
|
|
do_find(${MODULE_NAME})
|
2012-01-17 02:37:13 +04:00
|
|
|
endif ()
|
|
|
|
|
2012-08-13 21:50:14 +04:00
|
|
|
endforeach()
|
2012-01-18 21:23:21 +04:00
|
|
|
|
|
|
|
# Qt4 is not present, so we can check Qt3
|
2012-01-27 01:10:31 +04:00
|
|
|
if (NOT QT4_FOUND)
|
2012-01-27 01:17:10 +04:00
|
|
|
set(DESIRED_QT_VERSION 3)
|
|
|
|
foreach(FIND_MODULE ${NO_QT4_MODULES} "Qt")
|
2012-01-18 21:23:21 +04:00
|
|
|
do_find(${FIND_MODULE})
|
2012-08-13 21:50:14 +04:00
|
|
|
endforeach()
|
|
|
|
endif ()
|
2012-01-30 22:25:07 +04:00
|
|
|
|
2012-02-24 23:35:42 +04:00
|
|
|
macro(check_version_string MODULE_NAME VERSION_VAR)
|
|
|
|
if (${MODULE_NAME}_FOUND)
|
|
|
|
if (DEFINED ${VERSION_VAR})
|
2012-03-21 00:18:02 +04:00
|
|
|
message(STATUS "${VERSION_VAR}='${${VERSION_VAR}}'")
|
|
|
|
if (NOT ${VERSION_VAR} MATCHES "^[0-9]")
|
|
|
|
message(SEND_ERROR "unexpected: ${VERSION_VAR} does not begin with a decimal digit")
|
|
|
|
endif()
|
|
|
|
if ("${${VERSION_VAR}}" STREQUAL "")
|
|
|
|
message(SEND_ERROR "unexpected: ${VERSION_VAR} is empty")
|
|
|
|
endif()
|
|
|
|
if (${VERSION_VAR} VERSION_EQUAL 0)
|
|
|
|
message(SEND_ERROR "unexpected: ${VERSION_VAR} is VERSION_EQUAL 0")
|
|
|
|
endif()
|
|
|
|
if (NOT ${VERSION_VAR} VERSION_GREATER 0)
|
|
|
|
message(SEND_ERROR "unexpected: ${VERSION_VAR} is NOT VERSION_GREATER 0")
|
2012-01-30 22:25:07 +04:00
|
|
|
endif()
|
|
|
|
else()
|
2012-03-21 00:18:02 +04:00
|
|
|
message(SEND_ERROR "${MODULE_NAME}_FOUND is set but version number variable ${VERSION_VAR} is NOT DEFINED")
|
2012-01-30 22:25:07 +04:00
|
|
|
endif()
|
2012-02-24 23:35:42 +04:00
|
|
|
endif ()
|
2012-08-13 21:50:14 +04:00
|
|
|
endmacro()
|
2012-02-24 23:35:42 +04:00
|
|
|
|
|
|
|
# If any of these modules reported that it was found a version number should have been
|
|
|
|
# reported.
|
|
|
|
|
2012-10-16 16:06:32 +04:00
|
|
|
foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG
|
|
|
|
HSPELL ICOTOOL JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG
|
|
|
|
PostgreSQL TIFF ZLIB)
|
2012-02-24 23:35:42 +04:00
|
|
|
check_version_string(${VTEST} ${VTEST}_VERSION_STRING)
|
2012-08-13 21:50:14 +04:00
|
|
|
endforeach()
|
2012-02-24 23:35:42 +04:00
|
|
|
|
|
|
|
foreach(VTEST BISON Boost CUDA DOXYGEN FLEX GIF GTK2 LibArchive OPENSCENEGRAPH
|
|
|
|
RUBY SWIG)
|
|
|
|
check_version_string(${VTEST} ${VTEST}_VERSION)
|
2012-08-13 21:50:14 +04:00
|
|
|
endforeach()
|
2012-02-24 23:35:42 +04:00
|
|
|
|
|
|
|
check_version_string(PYTHONINTERP PYTHON_VERSION_STRING)
|
|
|
|
check_version_string(SUBVERSION Subversion_VERSION_SVN)
|