diff options
-rw-r--r-- | modules/FindKDE4Internal.cmake | 53 | ||||
-rw-r--r-- | modules/FindQt4.cmake | 33 |
2 files changed, 68 insertions, 18 deletions
diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index f3a1d93c..76e1648b 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -258,12 +258,21 @@ if(NOT KDE4_FOUND) include (MacroEnsureVersion) +# we may only search for other packages with "REQUIRED" if we are required ourselves +if(KDE4_FIND_REQUIRED) + set(_REQ_STRING_KDE4 "REQUIRED") + set(_REQ_STRING_KDE4_MESSAGE "FATAL_ERROR") +else(KDE4_FIND_REQUIRED) + set(_REQ_STRING_KDE4 ) + set(_REQ_STRING_KDE4_MESSAGE "STATUS") +endif(KDE4_FIND_REQUIRED) + set(QT_MIN_VERSION "4.4.0") #this line includes FindQt4.cmake, which searches the Qt library and headers -find_package(Qt4 REQUIRED) +find_package(Qt4 ${_REQ_STRING_KDE4}) # automoc4 (from kdesupport) is now required, Alex -find_package(Automoc4 REQUIRED) +find_package(Automoc4 ${_REQ_STRING_KDE4}) # cmake 2.6.0 and automoc4 < 0.9.84 don't work right for -D flags if (NOT AUTOMOC4_VERSION) @@ -271,15 +280,43 @@ if (NOT AUTOMOC4_VERSION) set(AUTOMOC4_VERSION "0.9.83") endif (NOT AUTOMOC4_VERSION) macro_ensure_version("0.9.84" "${AUTOMOC4_VERSION}" _automoc4_version_ok) -if (NOT _automoc4_version_ok) - message(FATAL_ERROR "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.84") -endif (NOT _automoc4_version_ok) -# use automoc4 from kdesupport +# for compatibility with KDE 4.0.x set(KDE4_AUTOMOC_EXECUTABLE "${AUTOMOC4_EXECUTABLE}" ) -# Perl is required for building KDE software, -find_package(Perl REQUIRED) +# Perl is required for building KDE software +find_package(Perl ${_REQ_STRING_KDE4}) + +# Check that we really found everything. +# If KDE4 was searched with REQUIRED, we error out with FATAL_ERROR if something wasn't found +# already above in the other FIND_PACKAGE() calls. +# If KDE4 was searched without REQUIRED and something in the FIND_PACKAGE() calls above wasn't found, +# then we get here and must check that everything has actually been found. If something is missing, +# we must not fail with FATAL_ERROR, but only not set KDE4_FOUND. +if(NOT PERL_FOUND) + message(STATUS "KDE4 not found, because Perl not found") + return() +endif(NOT PERL_FOUND) + +if(NOT QT4_FOUND) + message(STATUS "KDE4 not found, because Qt4 not found") + return() +endif(NOT QT4_FOUND) + +if(NOT AUTOMOC4_FOUND OR NOT _automoc4_version_ok) + if(NOT AUTOMOC4_FOUND) + message(${_REQ_STRING_KDE4_MESSAGE} "KDE4 not found, because Automoc4 not found.") + return() + else(NOT AUTOMOC4_FOUND) + if(NOT _automoc4_version_ok) + message(${_REQ_STRING_KDE4_MESSAGE} "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.84") + return() + endif(NOT _automoc4_version_ok) + endif(NOT AUTOMOC4_FOUND) +endif(NOT AUTOMOC4_FOUND OR NOT _automoc4_version_ok) + + +# now we are sure we have everything we need include (MacroLibrary) include (CheckCXXCompilerFlag) diff --git a/modules/FindQt4.cmake b/modules/FindQt4.cmake index 55c44dfd..8952807d 100644 --- a/modules/FindQt4.cmake +++ b/modules/FindQt4.cmake @@ -259,10 +259,24 @@ # Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. # See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. -if (QT4_QMAKE_FOUND) - # Check already done in this cmake run, nothing more to do -else (QT4_QMAKE_FOUND) +# If Qt3 has already been found, fail. +IF(QT_QT_LIBRARY) + IF(Qt4_FIND_REQUIRED) + MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project.") + ELSE(Qt4_FIND_REQUIRED) + IF(NOT Qt4_FIND_QUIETLY) + MESSAGE( STATUS "Qt3 and Qt4 cannot be used together in one project.") + ENDIF(NOT Qt4_FIND_QUIETLY) + RETURN() + ENDIF(Qt4_FIND_REQUIRED) +ENDIF(QT_QTCORE_LIBRARY) + + +IF (QT4_QMAKE_FOUND) + # Check already done in this cmake run, nothing more to do + RETURN() +ENDIF (QT4_QMAKE_FOUND) # check that QT_NO_DEBUG is defined for release configurations MACRO(QT_CHECK_FLAG_EXISTS FLAG VAR DOC) @@ -501,9 +515,9 @@ IF (QT4_QMAKE_FOUND) ENDIF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) IF( NOT QT_INCLUDE_DIR) - IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) + IF(Qt4_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Could NOT find QtGlobal header") - ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) + ENDIF(Qt4_FIND_REQUIRED) ENDIF( NOT QT_INCLUDE_DIR) ############################################# @@ -925,9 +939,9 @@ IF (QT4_QMAKE_FOUND) ENDIF (QT_USE_FRAMEWORKS) IF( NOT QT_QTCORE_LIBRARY ) - IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) + IF(Qt4_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") - ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) + ENDIF(Qt4_FIND_REQUIRED) ENDIF( NOT QT_QTCORE_LIBRARY ) # Set QT_QTASSISTANT_LIBRARY @@ -1449,7 +1463,7 @@ IF (QT4_QMAKE_FOUND) SET( QT_QT_LIBRARY "") ELSE(QT4_QMAKE_FOUND) - + SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE) IF(Qt4_FIND_REQUIRED) IF(QT4_INSTALLED_VERSION_TOO_OLD) @@ -1462,7 +1476,6 @@ ELSE(QT4_QMAKE_FOUND) MESSAGE(STATUS "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required") ENDIF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY) ENDIF(Qt4_FIND_REQUIRED) - -ENDIF (QT4_QMAKE_FOUND) + ENDIF (QT4_QMAKE_FOUND) |