BUG: fix #7447, FindModulesExecuteAll test fails if both Qt3 and KDE4 can be

found in the system

Qt3 and Qt4 cannot be used together in one project.
Now Qt3/KDE3 and Qt4/KDE4 handle the case that this is done nevertheless
properly, i.e. they fail with FATAL_ERROR if it was REQUIRED and they fail
with just MESSAGE(STATUS ...) and RETURN() if it was not REQUIRED

BUG: make FindQt4 error out with FATAL_ERROR also if it was searched QUIET

Alex
This commit is contained in:
Alexander Neundorf 2008-08-16 19:11:53 -04:00
parent 814b368725
commit db4bebe5c8
4 changed files with 55 additions and 6 deletions

View File

@ -67,6 +67,18 @@ IF(NOT UNIX AND KDE3_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported")
ENDIF(NOT UNIX AND KDE3_FIND_REQUIRED)
# If Qt4 has already been found, fail.
IF(QT4_FOUND)
IF(KDE3_FIND_REQUIRED)
MESSAGE( FATAL_ERROR "KDE3/Qt3 and Qt4 cannot be used together in one project.")
ELSE(KDE3_FIND_REQUIRED)
IF(NOT KDE3_FIND_QUIETLY)
MESSAGE( STATUS "KDE3/Qt3 and Qt4 cannot be used together in one project.")
ENDIF(NOT KDE3_FIND_QUIETLY)
RETURN()
ENDIF(KDE3_FIND_REQUIRED)
ENDIF(QT4_FOUND)
SET(QT_MT_REQUIRED TRUE)
#SET(QT_MIN_VERSION "3.0.0")

View File

@ -9,6 +9,18 @@
#
# Author: Alexander Neundorf <neundorf@kde.org>
# If Qt3 has already been found, fail.
IF(QT_QT_LIBRARY)
IF(KDE4_FIND_REQUIRED)
MESSAGE( FATAL_ERROR "KDE4/Qt4 and Qt3 cannot be used together in one project.")
ELSE(KDE4_FIND_REQUIRED)
IF(NOT KDE4_FIND_QUIETLY)
MESSAGE( STATUS "KDE4/Qt4 and Qt3 cannot be used together in one project.")
ENDIF(NOT KDE_FIND_QUIETLY)
RETURN()
ENDIF(KDE4_FIND_REQUIRED)
ENDIF(QT_QTCORE_LIBRARY)
FILE(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
# when cross compiling, searching kde4-config in order to run it later on

View File

@ -20,6 +20,19 @@
# QT_WRAP_CPP, set true if QT_MOC_EXECUTABLE is found
# QT_WRAP_UI set true if QT_UIC_EXECUTABLE is found
# If Qt4 has already been found, fail.
IF(QT4_FOUND)
IF(Qt3_FIND_REQUIRED)
MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project.")
ELSE(Qt3_FIND_REQUIRED)
IF(NOT Qt3_FIND_QUIETLY)
MESSAGE( STATUS "Qt3 and Qt4 cannot be used together in one project.")
ENDIF(NOT Qt3_FIND_QUIETLY)
RETURN()
ENDIF(Qt3_FIND_REQUIRED)
ENDIF(QT4_FOUND)
FILE(GLOB GLOB_PATHS_BIN /usr/lib/qt-3*/bin/)
FIND_PATH(QT_INCLUDE_DIR qt.h
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
@ -39,7 +52,7 @@ FIND_PATH(QT_INCLUDE_DIR qt.h
# if qglobal.h is not in the qt_include_dir then set
# QT_INCLUDE_DIR to NOTFOUND
IF(NOT EXISTS ${QT_INCLUDE_DIR}/qglobal.h)
SET(QT_INCLUDE_DIR QT_INCLUDE_DIR-NOTFOUND CACHE PATH "path to qt3 include directory" FORCE)
SET(QT_INCLUDE_DIR QT_INCLUDE_DIR-NOTFOUND CACHE PATH "path to Qt3 include directory" FORCE)
ENDIF(NOT EXISTS ${QT_INCLUDE_DIR}/qglobal.h)
IF(QT_INCLUDE_DIR)
@ -51,7 +64,6 @@ IF(QT_INCLUDE_DIR)
# Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the
# version X.Y.Z, so we need to remove the dots from version
STRING(REGEX REPLACE "\\." "" qt_version_str_lib "${qt_version_str}")
ELSE(QT_INCLUDE_DIR)
ENDIF(QT_INCLUDE_DIR)
FILE(GLOB GLOB_PATHS_LIB /usr/lib/qt-3*/lib/)

View File

@ -256,6 +256,19 @@
# (They make no sense in Qt4)
# QT_QT_LIBRARY Qt-Library is now split
# 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)
INCLUDE(CheckSymbolExists)
INCLUDE(MacroAddFileDependencies)
@ -474,9 +487,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)
#############################################
@ -771,9 +784,9 @@ IF (QT4_QMAKE_FOUND)
ENDIF(EXISTS ${QT_LIBRARY_DIR}/libqtmain.a)
ENDIF(QT_LIBRARY_DIR AND MSVC)
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_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE )
# Set QT_QTASSISTANT_LIBRARY