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})
|
|
|
|
endmacro(do_find)
|
|
|
|
|
2012-01-27 01:10:31 +04:00
|
|
|
# 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
|
2012-01-27 01:17:10 +04:00
|
|
|
set(NO_QT4_MODULES "Qt3" "KDE3")
|
2012-01-27 01:10:31 +04:00
|
|
|
|
2012-01-27 01:26:00 +04:00
|
|
|
# These modules are named Find*.cmake, but are nothing that works in
|
|
|
|
# find_package().
|
|
|
|
set(NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage")
|
|
|
|
|
2012-01-27 01:17:10 +04:00
|
|
|
set(DESIRED_QT_VERSION 4)
|
2012-01-17 02:37:13 +04:00
|
|
|
foreach(FIND_MODULE ${FIND_MODULES})
|
|
|
|
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 ()
|
|
|
|
|
|
|
|
endforeach(FIND_MODULE)
|
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})
|
|
|
|
endforeach(FIND_MODULE)
|
2012-01-27 01:10:31 +04:00
|
|
|
endif (NOT QT4_FOUND)
|