diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2005-07-15 16:14:47 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2005-07-15 16:14:47 (GMT) |
commit | dc1426b6a3ad05d83acbca6bd26bf0f67dcd330d (patch) | |
tree | 6cea5edb3cb46e18d1da3bc3253290b97847863a /Modules | |
parent | 0dbf895780f15e8e701b14cd27ee88d0200ff726 (diff) | |
download | CMake-dc1426b6a3ad05d83acbca6bd26bf0f67dcd330d.zip CMake-dc1426b6a3ad05d83acbca6bd26bf0f67dcd330d.tar.gz CMake-dc1426b6a3ad05d83acbca6bd26bf0f67dcd330d.tar.bz2 |
ENH: add new qt stuff from warfield@bwh.harvard.edu, thanks
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindQt.cmake | 512 | ||||
-rw-r--r-- | Modules/FindQt3.cmake | 248 | ||||
-rw-r--r-- | Modules/FindQt4.cmake | 771 |
3 files changed, 1295 insertions, 236 deletions
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index c2cacc9..50e4bda 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -1,248 +1,288 @@ -# Locate Qt include paths and libraries - -# This module defines -# QT_INCLUDE_DIR, where to find qt.h, etc. -# QT_LIBRARIES, the libraries to link against to use Qt. -# QT_DEFINITIONS, definitions to use when compiling code that uses Qt. -# QT_FOUND, If false, don't try to use Qt. - -#if you need the multithreaded version of Qt, set QT_MT_REQUIRED to TRUE - -# also defined, but not for general use are -# QT_MOC_EXECUTABLE, where to find the moc tool. -# QT_UIC_EXECUTABLE, where to find the uic tool. -# QT_QT_LIBRARY, where to find the Qt library. -# QT_QTMAIN_LIBRARY, where to find the qtmain library. This is only required by Qt3 on Windows. - -# These are around for backwards compatibility -# they will be set -# QT_WRAP_CPP, set true if QT_MOC_EXECUTABLE is found -# QT_WRAP_UI set true if QT_UIC_EXECUTABLE is found - - -FIND_PATH(QT_INCLUDE_DIR qt.h - $ENV{QTDIR}/include - /usr/local/qt/include - /usr/local/include - /usr/lib/qt/include - /usr/include/qt - /usr/include - /usr/share/qt3/include - C:/Progra~1/qt/include - /usr/include/qt3 - /usr/X11R6/include - ) - -IF(QT_INCLUDE_DIR) - #extract the version string from qglobal.h - FILE(READ ${QT_INCLUDE_DIR}/qglobal.h QGLOBAL_H) - STRING(REGEX MATCH "#define[\t ]+QT_VERSION_STR[\t ]+\"([0-9]+.[0-9]+.[0-9]+)\"" QGLOBAL_H "${QGLOBAL_H}") - STRING(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+)\".*" "\\1" QGLOBAL_H "${QGLOBAL_H}") - - # 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 "${QGLOBAL_H}") -ELSE(QT_INCLUDE_DIR) -ENDIF(QT_INCLUDE_DIR) - - -IF (QT_MT_REQUIRED) - FIND_LIBRARY(QT_QT_LIBRARY - NAMES qt-mt qt-mt${qt_version_str_lib} qt-mt230nc - PATHS - $ENV{QTDIR}/lib - /usr/local/qt/lib - /usr/local/lib - /usr/lib/qt/lib - /usr/lib - /usr/share/qt3/lib - C:/Progra~1/qt/lib - /usr/X11R6/lib - ) - -ELSE (QT_MT_REQUIRED) - FIND_LIBRARY(QT_QT_LIBRARY - NAMES qt qt-${qt_version_str_lib} qt-mt qt-mt230nc - PATHS - $ENV{QTDIR}/lib - /usr/local/qt/lib - /usr/local/lib - /usr/lib/qt/lib - /usr/lib - /usr/share/qt3/lib - C:/Progra~1/qt/lib - /usr/X11R6/lib - ) -ENDIF (QT_MT_REQUIRED) - -IF(QT_QT_LIBRARY) -ELSE(QT_QT_LIBRARY) -ENDIF(QT_QT_LIBRARY) - - -FIND_LIBRARY(QT_QASSISTANTCLIENT_LIBRARY - NAMES qassistantclient - PATHS - $ENV{QTDIR}/lib - /usr/local/qt/lib - /usr/local/lib - /usr/lib - /usr/share/qt3/lib - C:/Progra~1/qt/lib - /usr/X11R6/lib - ) - -FIND_PROGRAM(QT_MOC_EXECUTABLE - NAMES moc moc-qt3 - PATHS - $ENV{QTDIR}/bin - /usr/local/qt/bin - /usr/lib/qt/bin - /usr/share/qt3/bin - C:/Progra~1/qt/bin - /usr/X11R6/bin - ) - -IF(QT_MOC_EXECUTABLE) - SET ( QT_WRAP_CPP "YES") -ELSE(QT_MOC_EXECUTABLE) -ENDIF(QT_MOC_EXECUTABLE) - -FIND_PROGRAM(QT_UIC_EXECUTABLE uic - $ENV{QTDIR}/bin - /usr/local/qt/bin - /usr/lib/qt/bin - /usr/share/qt3/bin - C:/Progra~1/qt/bin - /usr/X11R6/bin -) - -IF(QT_UIC_EXECUTABLE) - SET ( QT_WRAP_UI "YES") -ELSE(QT_UIC_EXECUTABLE) -ENDIF(QT_UIC_EXECUTABLE) - -IF (WIN32) - FIND_LIBRARY(QT_QTMAIN_LIBRARY qtmain - $ENV{QTDIR}/lib C:/Progra~1/qt/lib - DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise." - ) -ENDIF (WIN32) +# searches for the installed Qt-Version and desides which FindQtX.cmake to include +# +# This module uses +# QT_MAX_VERSION ,maximum Qt version set by YOU (e.g. "3.9.9") +# if it is not set, we assume (for compatibility) the project is old and uses Qt < 4 +# Qt > 3 projects have to (!) set QT_MAX_VERSION (maximum by Trolltech is "15.7.99") +# QT_MIN_VERSION ,minimum Qt version set by YOU (e.g. "2.2.3") +# +# This modules sets +# QT_INST_MAJOR_VERSION ,major number of the installed Qt (e.g. Qt-Version = 4.2.6 => 4) +# QT_INST_MINOR_VERSION ,minor number of the installed Qt (e.g. Qt-Version = 4.2.6 => 2) +# QT_INST_PATCH_VERSION ,patch number of the installed Qt (e.g. Qt-Version = 4.2.6 => 6) +# +# QT_FOUND ,gets set to YES or NO depending on QT_MAX_VERSION and QT_MIN_VERSION +########################################## +# +# init some internal variables +# +########################################## +IF(NOT QT_FOUND) + SET(QT_FOUND "NO") +ENDIF(NOT QT_FOUND) +# if a project needs Qt it has to call FoundQt.cmake and NOT FoundQt3.cmake, FoundQt4.cmake etc. This gets checked in FoundQt4.cmake etc. +SET(FOUNDQT_CALLED "YES") -IF (QT_MIN_VERSION) +# compatibility to CMakeList.txt files for Qt3 projects +IF(NOT QT_MAX_VERSION) + SET(QT_MAX_VERSION "3.9.9") +ENDIF(NOT QT_MAX_VERSION) - STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" qt_major_vers "${qt_version_str}") - STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" qt_minor_vers "${qt_version_str}") - STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" qt_patch_vers "${qt_version_str}") - - #now parse the parts of the user given version string into variables - STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+$" req_qt_major_vers "${QT_MIN_VERSION}") - IF (NOT req_qt_major_vers) - MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", expected e.g. \"3.1.5\"") - ENDIF (NOT req_qt_major_vers) +IF(NOT QT_MIN_VERSION) + SET(QT_MIN_VERSION "0.0.1") +ENDIF(NOT QT_MIN_VERSION) + +####################################### +# +# search for qglobal.h and sets +# QT_GLOBAL_H_FILE +# +####################################### +IF( NOT QT_QGLOBAL_H_FILE) + EXEC_PROGRAM( qmake + ARGS "-query QT_INSTALL_HEADERS" + OUTPUT_VARIABLE qt_headers ) - STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT_MIN_VERSION}") - STRING(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}") - STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}") + # Qt4-like search paths + FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h + ${qt_headers}/Qt + $ENV{QTDIR}/include/Qt + /usr/local/qt/include/Qt + /usr/local/include/Qt + /usr/lib/qt/include/Qt + /usr/include/Qt + /usr/share/qt4/include/Qt + C:/Progra~1/qt/include/Qt ) - # req = "6.5.4", qt = "3.2.1" + IF(QT4_QGLOBAL_H_FILE) + STRING(REGEX REPLACE "/include/Qt/qglobal.h" "" QT_DIR "${QT4_QGLOBAL_H_FILE}") + SET(QT_QGLOBAL_H_FILE ${QT4_QGLOBAL_H_FILE}) + ELSE(QT4_QGLOBAL_H_FILE) + #Qt3-like search paths + FIND_FILE( QT3_QGLOBAL_H_FILE qglobal.h + $ENV{QTDIR}/include + /usr/include/qt3/Qt + /usr/local/qt/include + /usr/local/include + /usr/lib/qt/include + /usr/include + /usr/share/qt3/include + C:/Progra~1/qt/include + /usr/include/qt3 ) + IF(QT3_QGLOBAL_H_FILE) + STRING(REGEX REPLACE "/include/qglobal.h" "" QT_DIR "${QT3_QGLOBAL_H_FILE}") + SET(QT_QGLOBAL_H_FILE ${QT3_QGLOBAL_H_FILE}) + ENDIF(QT3_QGLOBAL_H_FILE) + ENDIF(QT4_QGLOBAL_H_FILE) - IF (req_qt_major_vers GREATER qt_major_vers) # (6 > 3) ? - MESSAGE( FATAL_ERROR "Qt major version not matched (required: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes - ELSE (req_qt_major_vers GREATER qt_major_vers) # no - IF (req_qt_major_vers LESS qt_major_vers) # (6 < 3) ? - SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes - ELSE (req_qt_major_vers LESS qt_major_vers) # ( 6==3) ? - IF (req_qt_minor_vers GREATER qt_minor_vers) # (5>2) ? - MESSAGE( FATAL_ERROR "Qt minor version not matched (required: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes - ELSE (req_qt_minor_vers GREATER qt_minor_vers) # no - IF (req_qt_minor_vers LESS qt_minor_vers) # (5<2) ? - SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes - ELSE (req_qt_minor_vers LESS qt_minor_vers) # (5==2) - IF (req_qt_patch_vers GREATER qt_patch_vers) # (4>1) ? - MESSAGE( FATAL_ERROR "Qt patch level not matched (required: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes - ELSE (req_qt_patch_vers GREATER qt_patch_vers) # (4>1) ? - SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes - ENDIF (req_qt_patch_vers GREATER qt_patch_vers) # (4>1) ? - ENDIF (req_qt_minor_vers LESS qt_minor_vers) - ENDIF (req_qt_minor_vers GREATER qt_minor_vers) - ENDIF (req_qt_major_vers LESS qt_major_vers) - ENDIF (req_qt_major_vers GREATER qt_major_vers) -ENDIF (QT_MIN_VERSION) + #check if qglobal.h is just a file with includes qglobal.h from elsewhere + IF(QT_QGLOBAL_H_FILE) + FILE(READ "${QT_QGLOBAL_H_FILE}" QT_QGLOBAL_H) + #BUG!!! the regexpression is not correct. + #If "#include" and "qglobal.h" are in different lines it would be seen as ok + STRING(REGEX MATCH "#include.*qglobal.h" QT_QGLOBAL_H_LINK "${QT_QGLOBAL_H}") + + IF( QT_QGLOBAL_H_LINK ) + STRING(REGEX REPLACE ".*\"" "" QT_QGLOBAL_H_LINK "${QT_QGLOBAL_H_LINK}") + STRING(REGEX REPLACE "\\.\\./\\.\\." "${QT_DIR}" QT_QGLOBAL_H_FILE "${QT_QGLOBAL_H_LINK}") + ENDIF(QT_QGLOBAL_H_LINK) + ENDIF(QT_QGLOBAL_H_FILE) +ENDIF(NOT QT_QGLOBAL_H_FILE) -# if the include a library are found then we have it -IF(QT_INCLUDE_DIR) - IF(QT_QT_LIBRARY) - SET( QT_FOUND "YES" ) - ENDIF(QT_QT_LIBRARY) -ENDIF(QT_INCLUDE_DIR) - -IF(QT_FOUND) - SET( QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT_LIBRARY} ) - SET( QT_DEFINITIONS "") - - IF (WIN32 AND NOT CYGWIN) - IF (QT_QTMAIN_LIBRARY) - # for version 3 - SET (QT_DEFINITIONS "-DQT_DLL -DQT_THREAD_SUPPORT -DNO_DEBUG") - SET (QT_LIBRARIES imm32.lib ${QT_QT_LIBRARY} ${QT_QTMAIN_LIBRARY} ) - SET (QT_LIBRARIES ${QT_LIBRARIES} winmm wsock32) - ELSE (QT_QTMAIN_LIBRARY) - # for version 2 - SET (QT_LIBRARIES imm32.lib ws2_32.lib ${QT_QT_LIBRARY} ) - ENDIF (QT_QTMAIN_LIBRARY) - ELSE (WIN32 AND NOT CYGWIN) - SET (QT_LIBRARIES ${QT_QT_LIBRARY} ) +############################################################### +# +# read the version number of the installed of Qt and sets +# QT_INST_MAJOR_VERSION +# QT_INST_MINOR_VERSION +# QT_INST_PATCH_VERSION +# +############################################################### +IF( QT_QGLOBAL_H_FILE) + IF(NOT QT_INST_MAJOR_VERSION OR NOT QT_INST_MINOR_VERSION OR NOT QT_INST_PATCH_VERSION) + #extract the version string from qglobal.h + FILE(READ ${QT_QGLOBAL_H_FILE} QT_QGLOBAL_H) - SET (QT_DEFINITIONS "-DQT_SHARED -DQT_NO_DEBUG") - IF(QT_QT_LIBRARY MATCHES "qt-mt") - SET (QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_THREAD_SUPPORT -D_REENTRANT) - ENDIF(QT_QT_LIBRARY MATCHES "qt-mt") + # BUG !!! ... THE NEXT LINE DOES NOT WORK FOR Qt10 (even though that´s in far future) + # Trolltech defines in src/corelib/global/qglobal.h: QT_VERSION is (major << 16) + (minor << 8) + patch. - ENDIF (WIN32 AND NOT CYGWIN) - - IF (QT_QASSISTANTCLIENT_LIBRARY) - SET (QT_LIBRARIES ${QT_QASSISTANTCLIENT_LIBRARY} ${QT_LIBRARIES}) - ENDIF (QT_QASSISTANTCLIENT_LIBRARY) - - # Backwards compatibility for CMake1.4 and 1.2 - SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) - SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) - # for unix add X11 stuff - IF(UNIX) - FIND_PACKAGE(X11) - IF (X11_FOUND) - SET (QT_LIBRARIES ${QT_LIBRARIES} ${X11_LIBRARIES}) - ENDIF (X11_FOUND) - IF (CMAKE_DL_LIBS) - SET (QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_DL_LIBS}) - ENDIF (CMAKE_DL_LIBS) - ENDIF(UNIX) - IF(QT_QT_LIBRARY MATCHES "qt-mt") - FIND_PACKAGE(Threads) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) - ENDIF(QT_QT_LIBRARY MATCHES "qt-mt") -ENDIF(QT_FOUND) - - -IF (QT_MOC_EXECUTABLE) - SET ( QT_WRAP_CPP "YES") -ENDIF (QT_MOC_EXECUTABLE) + STRING(REGEX MATCH "#define[\t ]+QT_VERSION_STR[\t ]+\"([0-9]+.[0-9]+.[0-9]+)" QT_QGLOBAL_H "${QT_QGLOBAL_H}") + STRING(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+).*" "\\1" QT_QGLOBAL_H "${QT_QGLOBAL_H}") -IF (QT_UIC_EXECUTABLE) - SET ( QT_WRAP_UI "YES") -ENDIF (QT_UIC_EXECUTABLE) - + # 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 (at least in Qt3) + STRING(REGEX REPLACE "\\." "" qt_version_str "${QT_QGLOBAL_H}") + + IF(NOT QT_INST_MAJOR_VERSION) + STRING(REGEX REPLACE "([0-9]+)[0-9]+[0-9]+" "\\1" QT_INST_MAJOR_VERSION "${qt_version_str}") + ENDIF(NOT QT_INST_MAJOR_VERSION) + IF(NOT QT_INST_MINOR_VERSION) + STRING(REGEX REPLACE "[0-9]+([0-9]+)[0-9]+" "\\1" QT_INST_MINOR_VERSION "${qt_version_str}") + ENDIF(NOT QT_INST_MINOR_VERSION) + IF(NOT QT_INST_PATCH_VERSION) + STRING(REGEX REPLACE "[0-9]+[0-9]+([0-9]+)" "\\1" QT_INST_PATCH_VERSION "${qt_version_str}") + ENDIF(NOT QT_INST_PATCH_VERSION) + ENDIF(NOT QT_INST_MAJOR_VERSION OR NOT QT_INST_MINOR_VERSION OR NOT QT_INST_PATCH_VERSION) + # set qt_version_str back to x.y.z to make message outputs readable + SET(qt_version_str "${QT_INST_MAJOR_VERSION}.${QT_INST_MINOR_VERSION}.${QT_INST_PATCH_VERSION}") +ELSE( QT_QGLOBAL_H_FILE ) + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Couldn´t find qglobal.h => Qt not installed.") + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + SET( QT_FOUND "NO" ) +ENDIF( QT_QGLOBAL_H_FILE ) + +IF( NOT Qt_FIND_QUIETLY) + MESSAGE(STATUS "Checking Qt-Version ${QT_INST_MAJOR_VERSION}.${QT_INST_MINOR_VERSION}.${QT_INST_PATCH_VERSION}") +ENDIF( NOT Qt_FIND_QUIETLY) + +############################################################# +# +# check the minimum requirments set in QT_MIN_VERSION +# +############################################################# +IF (QT_MIN_VERSION) + #now parse the parts of the user given version string into variables + STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+$" min_qt_major_vers "${QT_MIN_VERSION}") + IF (NOT min_qt_major_vers) + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", expected e.g. \"3.1.5\"") + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + SET( QT_FOUND "NO" ) + ELSE(NOT min_qt_major_vers) + STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" min_qt_major_vers "${QT_MIN_VERSION}") + STRING(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" min_qt_minor_vers "${QT_MIN_VERSION}") + STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" min_qt_patch_vers "${QT_MIN_VERSION}") + # min = "6.5.4", qt = "3.2.1" + + # check major number + IF (min_qt_major_vers GREATER QT_INST_MAJOR_VERSION) # (6 > 3) ? + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Qt major version too small (minimum: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + SET( QT_FOUND "NO" ) + ELSE (min_qt_major_vers GREATER QT_INST_MAJOR_VERSION) # no + IF (min_qt_major_vers LESS QT_INST_MAJOR_VERSION) # (6 < 3) ? + SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes + ELSE (min_qt_major_vers LESS QT_INST_MAJOR_VERSION) # ( 6==3) ? + + # check minor number + IF (min_qt_minor_vers GREATER QT_INST_MINOR_VERSION) # (5>2) ? + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Qt minor version too small (minimum: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + SET( QT_FOUND "NO" ) + ELSE (min_qt_minor_vers GREATER QT_INST_MINOR_VERSION) # no + IF (min_qt_minor_vers LESS QT_INST_MINOR_VERSION) # (5<2) ? + SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes + ELSE (min_qt_minor_vers LESS QT_INST_MINOR_VERSION) # (5==2) + + # check patch number + IF (min_qt_patch_vers GREATER QT_INST_PATCH_VERSION) # (4>1) ? + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Qt patch level too small (minimum: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + SET( QT_FOUND "NO" ) + ELSE (min_qt_patch_vers GREATER QT_INST_PATCH_VERSION) # (4>1) ? + SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes + ENDIF (min_qt_patch_vers GREATER QT_INST_PATCH_VERSION) # (4>1) ? + ENDIF (min_qt_minor_vers LESS QT_INST_MINOR_VERSION) + + ENDIF (min_qt_minor_vers GREATER QT_INST_MINOR_VERSION) + ENDIF (min_qt_major_vers LESS QT_INST_MAJOR_VERSION) + ENDIF (min_qt_major_vers GREATER QT_INST_MAJOR_VERSION) + ENDIF (NOT min_qt_major_vers) + +ENDIF (QT_MIN_VERSION) + + +############################################################# +# +# check the maximum requirments set in QT_MAX_VERSION +# +############################################################# +IF(QT_MAX_VERSION) + #now parse the parts of the user given version string into variables + STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+$" max_qt_major_vers "${QT_MAX_VERSION}") + IF (NOT max_qt_major_vers) + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Invalid Qt version string given: \"${QT_MAX_VERSION}\", expected e.g. \"4.1.5\"") + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + SET( QT_FOUND "NO" ) + ELSE(NOT max_qt_major_vers) + + STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" max_qt_major_vers "${QT_MAX_VERSION}") + STRING(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" max_qt_minor_vers "${QT_MAX_VERSION}") + STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" max_qt_patch_vers "${QT_MAX_VERSION}") + # max = "6.5.4", qt = "7.2.1" + + # check major number + IF (max_qt_major_vers LESS QT_INST_MAJOR_VERSION) # (6 < 3) ? + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Qt major version too big (maximum: ${QT_MAX_VERSION}, found: ${qt_version_str})") # yes + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + SET( QT_FOUND "NO" ) + ELSE (max_qt_major_vers LESS QT_INST_MAJOR_VERSION) # no + IF (max_qt_major_vers GREATER QT_INST_MAJOR_VERSION) # (6 < 3) ? + SET( QT_VERSION_SMALL_ENOUGH "YES" ) # yes + ELSE (max_qt_major_vers GREATER QT_INST_MAJOR_VERSION) # ( 6==3) ? + + # check minor number + IF (max_qt_minor_vers LESS QT_INST_MINOR_VERSION) # (5 < 2) ? + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Qt minor version too big (maximum: ${QT_MAX_VERSION}, found: ${qt_version_str})") # yes + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + SET( QT_FOUND "NO" ) + ELSE (max_qt_minor_vers LESS QT_INST_MINOR_VERSION) # no + IF (max_qt_minor_vers GREATER QT_INST_MINOR_VERSION) # (5 < 2) ? + SET( QT_VERSION_SMALL_ENOUGH "YES" ) # yes + ELSE (max_qt_minor_vers GREATER QT_INST_MINOR_VERSION) # (5==2) + + # check patch number + IF (max_qt_patch_vers LESS QT_INST_PATCH_VERSION) # (4 < 1) ? + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Qt patch level too big (maximum: ${QT_MAX_VERSION}, found: ${qt_version_str})") # yes + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + SET( QT_FOUND "NO" ) + ELSE (max_qt_patch_vers LESS QT_INST_PATCH_VERSION) # (4 < 1) ? + SET( QT_VERSION_SMALL_ENOUGH "YES" ) # yes + ENDIF (max_qt_patch_vers LESS QT_INST_PATCH_VERSION) # (4 > 1) ? + + ENDIF (max_qt_minor_vers GREATER QT_INST_MINOR_VERSION) + ENDIF (max_qt_minor_vers LESS QT_INST_MINOR_VERSION) + ENDIF (max_qt_major_vers GREATER QT_INST_MAJOR_VERSION) + ENDIF (max_qt_major_vers LESS QT_INST_MAJOR_VERSION) + ENDIF (NOT max_qt_major_vers) +ENDIF(QT_MAX_VERSION) + + +############################################################### +# +# include the correct FindQtX.cmake file if Qt was found +# (we only distinguage between major versions +# +############################################################### +IF(QT_VERSION_SMALL_ENOUGH AND QT_VERSION_BIG_ENOUGH) + # Call package for Qt3 + IF( QT_INST_MAJOR_VERSION LESS 4) + #BUG!!! should be FIND_PACKAGE(FindQt4.cmake) when part of CMake + INCLUDE(${CMAKE_INSTALL_PREFIX}/share/CMake/Modules/FindQt3.cmake) + ENDIF( QT_INST_MAJOR_VERSION LESS 4) + # Call package for Qt4 + IF( QT_INST_MAJOR_VERSION GREATER 3 ) + IF( QT_INST_MAJOR_VERSION LESS 5) + #BUG!!! should be FIND_PACKAGE(FindQt4.cmake) when part of CMake + INCLUDE(${CMAKE_INSTALL_PREFIX}/share/CMake/Modules/FindQt4.cmake) + ELSE( QT_INST_MAJOR_VERSION LESS 5) + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE(SEND_ERROR "Right now CMake supports only Qt-Versions less than 5.0.0") + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + SET(QT_FOUND "NO") + ENDIF( QT_INST_MAJOR_VERSION LESS 5) + ENDIF( QT_INST_MAJOR_VERSION GREATER 3 ) +ENDIF(QT_VERSION_SMALL_ENOUGH AND QT_VERSION_BIG_ENOUGH) + + + -MARK_AS_ADVANCED( - QT_INCLUDE_DIR - QT_QT_LIBRARY - QT_QTMAIN_LIBRARY - QT_QASSISTANTCLIENT_LIBRARY - QT_UIC_EXECUTABLE - QT_MOC_EXECUTABLE - QT_WRAP_CPP - QT_WRAP_UI - ) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake new file mode 100644 index 0000000..e6ea32f --- /dev/null +++ b/Modules/FindQt3.cmake @@ -0,0 +1,248 @@ +# Locate Qt include paths and libraries + +# This module defines +# QT_INCLUDE_DIR, where to find qt.h, etc. +# QT_LIBRARIES, the libraries to link against to use Qt. +# QT_DEFINITIONS, definitions to use when compiling code that uses Qt. +# QT_FOUND, If false, don't try to use Qt. + +#if you need the multithreaded version of Qt, set QT_MT_REQUIRED to TRUE + +# also defined, but not for general use are +# QT_MOC_EXECUTABLE, where to find the moc tool. +# QT_UIC_EXECUTABLE, where to find the uic tool. +# QT_QT_LIBRARY, where to find the Qt library. +# QT_QTMAIN_LIBRARY, where to find the qtmain library. This is only required by Qt3 on Windows. + +# These are around for backwards compatibility +# they will be set +# QT_WRAP_CPP, set true if QT_MOC_EXECUTABLE is found +# QT_WRAP_UI set true if QT_UIC_EXECUTABLE is found + + +FIND_PATH(QT_INCLUDE_DIR qt.h + $ENV{QTDIR}/include + /usr/local/qt/include + /usr/local/include + /usr/lib/qt/include + /usr/include/qt + /usr/include + /usr/share/qt3/include + C:/Progra~1/qt/include + /usr/include/qt3 + /usr/X11R6/include + ) + +IF(QT_INCLUDE_DIR) + #extract the version string from qglobal.h + FILE(READ ${QT_INCLUDE_DIR}/qglobal.h QGLOBAL_H) + STRING(REGEX MATCH "#define[\t ]+QT_VERSION_STR[\t ]+\"([0-9]+.[0-9]+.[0-9]+)\"" QGLOBAL_H "${QGLOBAL_H}") + STRING(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+)\".*" "\\1" QGLOBAL_H "${QGLOBAL_H}") + + # 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 "${QGLOBAL_H}") +ELSE(QT_INCLUDE_DIR) +ENDIF(QT_INCLUDE_DIR) + + +IF (QT_MT_REQUIRED) + FIND_LIBRARY(QT_QT_LIBRARY + NAMES qt-mt qt-mt${qt_version_str_lib} qt-mt230nc + PATHS + $ENV{QTDIR}/lib + /usr/local/qt/lib + /usr/local/lib + /usr/lib/qt/lib + /usr/lib + /usr/share/qt3/lib + C:/Progra~1/qt/lib + /usr/X11R6/lib + ) + +ELSE (QT_MT_REQUIRED) + FIND_LIBRARY(QT_QT_LIBRARY + NAMES qt qt-${qt_version_str_lib} qt-mt qt-mt230nc + PATHS + $ENV{QTDIR}/lib + /usr/local/qt/lib + /usr/local/lib + /usr/lib/qt/lib + /usr/lib + /usr/share/qt3/lib + C:/Progra~1/qt/lib + /usr/X11R6/lib + ) +ENDIF (QT_MT_REQUIRED) + +IF(QT_QT_LIBRARY) +ELSE(QT_QT_LIBRARY) +ENDIF(QT_QT_LIBRARY) + + +FIND_LIBRARY(QT_QASSISTANTCLIENT_LIBRARY + NAMES qassistantclient + PATHS + $ENV{QTDIR}/lib + /usr/local/qt/lib + /usr/local/lib + /usr/lib + /usr/share/qt3/lib + C:/Progra~1/qt/lib + /usr/X11R6/lib + ) + +FIND_PROGRAM(QT_MOC_EXECUTABLE + NAMES moc moc-qt3 + PATHS + $ENV{QTDIR}/bin + /usr/local/qt/bin + /usr/lib/qt/bin + /usr/share/qt3/bin + C:/Progra~1/qt/bin + /usr/X11R6/bin + ) + +IF(QT_MOC_EXECUTABLE) + SET ( QT_WRAP_CPP "YES") +ELSE(QT_MOC_EXECUTABLE) +ENDIF(QT_MOC_EXECUTABLE) + +FIND_PROGRAM(QT_UIC_EXECUTABLE uic + $ENV{QTDIR}/bin + /usr/local/qt/bin + /usr/lib/qt/bin + /usr/share/qt3/bin + C:/Progra~1/qt/bin + /usr/X11R6/bin + ) + +IF(QT_UIC_EXECUTABLE) + SET ( QT_WRAP_UI "YES") +ELSE(QT_UIC_EXECUTABLE) +ENDIF(QT_UIC_EXECUTABLE) + +IF (WIN32) + FIND_LIBRARY(QT_QTMAIN_LIBRARY qtmain + $ENV{QTDIR}/lib C:/Progra~1/qt/lib + DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise." + ) +ENDIF (WIN32) + + +IF (QT_MIN_VERSION) + + STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" qt_major_vers "${qt_version_str}") + STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" qt_minor_vers "${qt_version_str}") + STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" qt_patch_vers "${qt_version_str}") + + #now parse the parts of the user given version string into variables + STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+$" req_qt_major_vers "${QT_MIN_VERSION}") + IF (NOT req_qt_major_vers) + MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", expected e.g. \"3.1.5\"") + ENDIF (NOT req_qt_major_vers) + + STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT_MIN_VERSION}") + STRING(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}") + STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}") + + # req = "6.5.4", qt = "3.2.1" + + IF (req_qt_major_vers GREATER qt_major_vers) # (6 > 3) ? + MESSAGE( FATAL_ERROR "Qt major version not matched (required: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes + ELSE (req_qt_major_vers GREATER qt_major_vers) # no + IF (req_qt_major_vers LESS qt_major_vers) # (6 < 3) ? + SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes + ELSE (req_qt_major_vers LESS qt_major_vers) # ( 6==3) ? + IF (req_qt_minor_vers GREATER qt_minor_vers) # (5>2) ? + MESSAGE( FATAL_ERROR "Qt minor version not matched (required: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes + ELSE (req_qt_minor_vers GREATER qt_minor_vers) # no + IF (req_qt_minor_vers LESS qt_minor_vers) # (5<2) ? + SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes + ELSE (req_qt_minor_vers LESS qt_minor_vers) # (5==2) + IF (req_qt_patch_vers GREATER qt_patch_vers) # (4>1) ? + MESSAGE( FATAL_ERROR "Qt patch level not matched (required: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes + ELSE (req_qt_patch_vers GREATER qt_patch_vers) # (4>1) ? + SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes + ENDIF (req_qt_patch_vers GREATER qt_patch_vers) # (4>1) ? + ENDIF (req_qt_minor_vers LESS qt_minor_vers) + ENDIF (req_qt_minor_vers GREATER qt_minor_vers) + ENDIF (req_qt_major_vers LESS qt_major_vers) + ENDIF (req_qt_major_vers GREATER qt_major_vers) +ENDIF (QT_MIN_VERSION) + +# if the include a library are found then we have it +IF(QT_INCLUDE_DIR) + IF(QT_QT_LIBRARY) + SET( QT_FOUND "YES" ) + ENDIF(QT_QT_LIBRARY) +ENDIF(QT_INCLUDE_DIR) + +IF(QT_FOUND) + SET( QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT_LIBRARY} ) + SET( QT_DEFINITIONS "") + + IF (WIN32 AND NOT CYGWIN) + IF (QT_QTMAIN_LIBRARY) + # for version 3 + SET (QT_DEFINITIONS "-DQT_DLL -DQT_THREAD_SUPPORT -DNO_DEBUG") + SET (QT_LIBRARIES imm32.lib ${QT_QT_LIBRARY} ${QT_QTMAIN_LIBRARY} ) + SET (QT_LIBRARIES ${QT_LIBRARIES} winmm wsock32) + ELSE (QT_QTMAIN_LIBRARY) + # for version 2 + SET (QT_LIBRARIES imm32.lib ws2_32.lib ${QT_QT_LIBRARY} ) + ENDIF (QT_QTMAIN_LIBRARY) + ELSE (WIN32 AND NOT CYGWIN) + SET (QT_LIBRARIES ${QT_QT_LIBRARY} ) + + SET (QT_DEFINITIONS "-DQT_SHARED -DQT_NO_DEBUG") + IF(QT_QT_LIBRARY MATCHES "qt-mt") + SET (QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_THREAD_SUPPORT -D_REENTRANT) + ENDIF(QT_QT_LIBRARY MATCHES "qt-mt") + + ENDIF (WIN32 AND NOT CYGWIN) + + IF (QT_QASSISTANTCLIENT_LIBRARY) + SET (QT_LIBRARIES ${QT_QASSISTANTCLIENT_LIBRARY} ${QT_LIBRARIES}) + ENDIF (QT_QASSISTANTCLIENT_LIBRARY) + + # Backwards compatibility for CMake1.4 and 1.2 + SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) + SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) + # for unix add X11 stuff + IF(UNIX) + FIND_PACKAGE(X11) + IF (X11_FOUND) + SET (QT_LIBRARIES ${QT_LIBRARIES} ${X11_LIBRARIES}) + ENDIF (X11_FOUND) + IF (CMAKE_DL_LIBS) + SET (QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_DL_LIBS}) + ENDIF (CMAKE_DL_LIBS) + ENDIF(UNIX) + IF(QT_QT_LIBRARY MATCHES "qt-mt") + FIND_PACKAGE(Threads) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) + ENDIF(QT_QT_LIBRARY MATCHES "qt-mt") +ENDIF(QT_FOUND) + + +IF (QT_MOC_EXECUTABLE) + SET ( QT_WRAP_CPP "YES") +ENDIF (QT_MOC_EXECUTABLE) + +IF (QT_UIC_EXECUTABLE) + SET ( QT_WRAP_UI "YES") +ENDIF (QT_UIC_EXECUTABLE) + + + +MARK_AS_ADVANCED( + QT_INCLUDE_DIR + QT_QT_LIBRARY + QT_QTMAIN_LIBRARY + QT_QASSISTANTCLIENT_LIBRARY + QT_UIC_EXECUTABLE + QT_MOC_EXECUTABLE + QT_WRAP_CPP + QT_WRAP_UI + ) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake new file mode 100644 index 0000000..1f0da7b --- /dev/null +++ b/Modules/FindQt4.cmake @@ -0,0 +1,771 @@ +######################################################################## +# +# DO NOT CALL THIS DIRECTLY +# LET FindQt.cmake deside which FindQtX.cmake to include +# +# Locates Qt4 include paths and libraries (called by FindQt.cmake) +# +######################################################################## + +# This module defines +# QT_INCLUDES ,list of paths to all include directories of Qt4 +# +# QT_INCLUDE_DIR ,path to "include" of Qt4 +# QT_QT_INCLUDE_DIR ,path to "include/Qt" of Qt4 +# QT_QT3SUPPORT_INCLUDE_DIR ,path to "include/Qt3Support" of Qt +# QT_QTASSISTANT_INCLUDE_DIR ,path to "include/QtAssistant" of Qt4 +# QT_QTCORE_INCLUDE_DIR ,path to "include/QtCore" of Qt4 +# QT_QTDESIGNER_INCLUDE_DIR ,path to "include/QtDesigner" of Qt4 +# QT_QTGUI_INCLUDE_DIR ,path to "include/QtGui" of Qt4 +# QT_QTMOTIF_INCLUDE_DIR ,path to "include/QtMotif" of Qt4 +# QT_QTNETWORK_INCLUDE_DIR ,path to "include/QtNetwork" of Qt4 +# QT_QTNSPLUGIN_INCLUDE_DIR ,path to "include/QtNsPlugin" of Qt4 +# QT_QTOPENGL_INCLUDE_DIR ,path to "include/QtOpenGL" of Qt4 +# QT_QTSQL_INCLUDE_DIR ,path to "include/QtSql" of Qt4 +# QT_QTXML_INCLUDE_DIR ,path to "include/QtXml" of Qt4 +# +# QT_LIBRARIES ,list of path+filename of all optimized libs of Qt4 +# QT_LIBRARIES_DEBUG ,list of path+filename of all debug libs of Qt4 +# QT_LIBRARIES_TRYOPTIMIZED ,list of path+filename of all libs (try optimized, if not found try debug) +# QT_LIBRARIES_TRYDEBUG ,list of path+filename of all libs (try debug, if not found try optimized) +# QT_LIBRARY_DIR ,path to "lib" of Qt4 +# +# QT_QT3SUPPORT_LIBRARY ,path+filename for Qt3Support library of Qt4 +# QT_QTASSISTANT_LIBRARY ,path+filename for QtAssistant library of Qt4 +# QT_QTCORE_LIBRARY ,path+filename for QtCore library of Qt4 +# QT_QTDESIGNER_LIBRARY ,path+filename for QtDesigner library of Qt4 +# QT_QTGUI_LIBRARY ,path+filename for QtGui library of Qt4 +# QT_QTMOTIF_LIBRARY ,path+filename for QtMotif library of Qt4 +# QT_QTNETWORK_LIBRARY ,path+filename for QtNetwork library of Qt4 +# QT_QTNSPLUGIN_LIBRARY ,path+filename for QtNsPlugin library of Qt4 +# QT_QTOPENGL_LIBRARY ,path+filename for QtOpenGL library of Qt4 +# QT_QTSQL_LIBRARY ,path+filename for QtSql library of Qt4 +# QT_QTXML_LIBRARY ,path+filename for QtXml library of Qt4 +# +# QT_QT3SUPPORT_LIBRARY_DEBUG ,path+filename for Qt3Support_debug library of Qt +# QT_QTASSISTANT_LIBRARY_DEBUG ,path+filename for QtAssistant_debug library of Qt4 +# QT_QTCORE_LIBRARY_DEBUG ,path+filename for QtCore_debug library of Qt4 +# QT_QTDESIGNER_LIBRARY_DEBUG ,path+filename for QtDesigner_debug library of Qt4 +# QT_QTGUI_LIBRARY_DEBUG ,path+filename for QtGui_debug library of Qt4 +# QT_QTMOTIF_LIBRARY_DEBUG ,path+filename for QtMotif_debug library of Qt4 +# QT_QTNETWORK_LIBRARY_DEBUG ,path+filename for QtNetwork_debug library of Qt4 +# QT_QTNSPLUGIN_LIBRARY_DEBUG ,path+filename for QtNsPlugin_debug library of Qt4 +# QT_QTOPENGL_LIBRARY_DEBUG ,path+filename for QtOpenGL_debug library of Qt4 +# QT_QTSQL_LIBRARY_DEBUG ,path+filename for QtSql_debug library of Qt4 +# QT_QTXML_LIBRARY_DEBUG ,path+filename for QtXml_debug library of Qt4 +# +# QT_DEFINITIONS ,definitions to use when compiling code that uses Qt. +# QT_FOUND ,If false, don't try to use Qt (depends on existence of QT_LIBRARY_DIR and QT_INCLUDE_DIR) +# +# also defined, but not for general use are +# QT_MOC_EXECUTABLE ,where to find the moc tool. +# QT_UIC_EXECUTABLE ,where to find the uic tool. +# QT_RCC_EXECUTABLE ,where to find the rcc tool +# +# These are around for backwards compatibility +# they will be set +# QT_WRAP_CPP ,set true if QT_MOC_EXECUTABLE is found +# QT_WRAP_UI ,set true if QT_UIC_EXECUTABLE is found +# +# +# These variables do _NOT_ have any effect anymore (compared to FindQt.cmake) +# QT_MT_REQUIRED , Qt4 is now always multithreaded +# +# These variables are set to "" , because Qt structure changed (They make no sence in Qt4) +# QT_QT_LIBRARY , Qt-Library is now splitt into different parts +# QT_QTMAIN_LIBRARY , Qt-Library is now splitt into different parts + +######################################## +# +# Make sure nobody runs this +# script directly +# only FoundQt.cmake are allowed to +# +######################################## +IF(NOT FOUNDQT_CALLED) + MESSAGE( FATAL_ERROR "Never call FoundQt4.cmake directly. Use FoundQt.cmake.") +ENDIF(NOT FOUNDQT_CALLED) + +######################################## +# +# Setting the INCLUDE-Variables +# +######################################## +# Set QT_QT_INCLUDE_DIR by searching for qglobal.h +IF(NOT QT_QT_INCLUDE_DIR) + EXEC_PROGRAM( qmake + ARGS "-query QT_INSTALL_HEADERS" + OUTPUT_VARIABLE qt_headers ) + FIND_PATH( QT_QT_INCLUDE_DIR qglobal.h + ${qt_headers}/Qt + $ENV{QTDIR}/include/Qt + /usr/local/qt/include/Qt + /usr/local/include/Qt + /usr/lib/qt/include/Qt + /usr/include/Qt + /usr/share/qt4/include/Qt + C:/Progra~1/qt/include/Qt + /usr/include/qt4/Qt) +ENDIF(NOT QT_QT_INCLUDE_DIR) + +# Set QT_INCLUDE_DIR by removine "/Qt" in the string ${QT_QT_INCLUDE_DIR} +IF(NOT QT_INCLUDE_DIR) + IF( QT_QT_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) + STRING( REGEX REPLACE "/Qt$" "" qt4_include_dir ${QT_QT_INCLUDE_DIR}) + SET( QT_INCLUDE_DIR ${qt4_include_dir}) + ELSE( QT_QT_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) + IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Could not find qglobal.h") + ENDIF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED) + ENDIF( QT_QT_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) +ENDIF(NOT QT_INCLUDE_DIR) + +# Set QT_QT3SUPPORT_INCLUDE_DIR +IF(NOT QT_QT3SUPPORT_INCLUDE_DIR) + FIND_PATH( QT_QT3SUPPORT_INCLUDE_DIR Qt3Support ${QT_INCLUDE_DIR}/Qt3Support) + IF( NOT QT_QT3SUPPORT_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/Qt3Support") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QT3SUPPORT_INCLUDE_DIR ) +ENDIF(NOT QT_QT3SUPPORT_INCLUDE_DIR) + +# Set QT_QTASSISTANT_INCLUDE_DIR +IF(NOT QT_QTASSISTANT_INCLUDE_DIR) + FIND_PATH( QT_QTASSISTANT_INCLUDE_DIR QtAssistant ${QT_INCLUDE_DIR}/QtAssistant) + IF( NOT QT_QTASSISTANT_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtAssistant") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QTASSISTANT_INCLUDE_DIR ) +ENDIF(NOT QT_QTASSISTANT_INCLUDE_DIR) + +# Set QT_QTCORE_INCLUDE_DIR +IF(NOT QT_QTCORE_INCLUDE_DIR) + FIND_PATH( QT_QTCORE_INCLUDE_DIR QtCore ${QT_INCLUDE_DIR}/QtCore) + IF( NOT QT_QTCORE_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtCore") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QTCORE_INCLUDE_DIR ) +ENDIF(NOT QT_QTCORE_INCLUDE_DIR) + +# Set QT_QTDESIGNER_INCLUDE_DIR +IF(NOT QT_QTDESIGNER_INCLUDE_DIR) + FIND_PATH( QT_QTDESIGNER_INCLUDE_DIR QtDesigner ${QT_INCLUDE_DIR}/QtDesigner) + IF( NOT QT_QTDESIGNER_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtDesigner") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QTDESIGNER_INCLUDE_DIR ) +ENDIF(NOT QT_QTDESIGNER_INCLUDE_DIR) + +# Set QT_QTGUI_INCLUDE_DIR +IF(NOT QT_QTGUI_INCLUDE_DIR) + FIND_PATH( QT_QTGUI_INCLUDE_DIR QtGui ${QT_INCLUDE_DIR}/QtGui) + IF( NOT QT_QTGUI_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtGui") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QTGUI_INCLUDE_DIR ) +ENDIF(NOT QT_QTGUI_INCLUDE_DIR) + +# Set QT_QTMOTIF_INCLUDE_DIR +IF(NOT QT_QTMOTIF_INCLUDE_DIR) + FIND_PATH( QT_QTMOTIF_INCLUDE_DIR QtMotif ${QT_INCLUDE_DIR}/QtMotif) + IF( NOT QT_QTMOTIF_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtMotif") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QTMOTIF_INCLUDE_DIR ) +ENDIF(NOT QT_QTMOTIF_INCLUDE_DIR) + +# Set QT_QTNETWORK_INCLUDE_DIR +IF(NOT QT_QTNETWORK_INCLUDE_DIR) + FIND_PATH( QT_QTNETWORK_INCLUDE_DIR QtNetwork ${QT_INCLUDE_DIR}/QtNetwork) + IF( NOT QT_QTNETWORK_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtNetwork") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QTNETWORK_INCLUDE_DIR ) +ENDIF(NOT QT_QTNETWORK_INCLUDE_DIR) + +# Set QT_QTNSPLUGIN_INCLUDE_DIR +IF(NOT QT_QTNSPLUGIN_INCLUDE_DIR) + FIND_PATH( QT_QTNSPLUGIN_INCLUDE_DIR QtNsPlugin ${QT_INCLUDE_DIR}/QtNsPlugin) + IF( NOT QT_QTNSPLUGIN_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtNsPlugin") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QTNSPLUGIN_INCLUDE_DIR ) +ENDIF(NOT QT_QTNSPLUGIN_INCLUDE_DIR) + +# Set QT_QTOPENGL_INCLUDE_DIR +IF(NOT QT_QTOPENGL_INCLUDE_DIR) + FIND_PATH( QT_QTOPENGL_INCLUDE_DIR QtOpenGL ${QT_INCLUDE_DIR}/QtOpenGL) + IF( NOT QT_QTOPENGL_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtOpenGL") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QTOPENGL_INCLUDE_DIR ) +ENDIF(NOT QT_QTOPENGL_INCLUDE_DIR) + +# Set QT_QTSQL_INCLUDE_DIR +IF(NOT QT_QTSQL_INCLUDE_DIR) + FIND_PATH( QT_QTSQL_INCLUDE_DIR QtSql ${QT_INCLUDE_DIR}/QtSql) + IF( NOT QT_QTSQL_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtSql") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QTSQL_INCLUDE_DIR ) +ENDIF(NOT QT_QTSQL_INCLUDE_DIR) + + +# Set QT_QTXML_INCLUDE_DIR +IF(NOT QT_QTXML_INCLUDE_DIR) + FIND_PATH( QT_QTXML_INCLUDE_DIR QtXml ${QT_INCLUDE_DIR}/QtXml) + IF( NOT QT_QTXML_INCLUDE_DIR ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtXml") + ENDIF( NOT Qt_FIND_QUIETLY) + ENDIF( NOT QT_QTXML_INCLUDE_DIR ) +ENDIF(NOT QT_QTXML_INCLUDE_DIR) + +# Make variables changeble to the advanced user +MARK_AS_ADVANCED( + QT_INCLUDE_DIR + QT_QT_INCLUDE_DIR + QT_QT3SUPPORT_INCLUDE_DIR + QT_QTASSISTANT_INCLUDE_DIR + QT_QTCORE_INCLUDE_DIR + QT_QTDESIGNER_INCLUDE_DIR + QT_QTGUI_INCLUDE_DIR + QT_QTMOTIF_INCLUDE_DIR + QT_QTNETWORK_INCLUDE_DIR + QT_QTNSPLUGIN_INCLUDE_DIR + QT_QTOPENGL_INCLUDE_DIR + QT_QTSQL_INCLUDE_DIR + QT_QTXML_INCLUDE_DIR + ) + +# Set QT_INCLUDES +SET( QT_INCLUDES + ${QT_INCLUDE_DIR} + ${QT_QT_INCLUDE_DIR} + ${QT_QT3SUPPORT_INCLUDE_DIR} + ${QT_QTASSISTANT_INCLUDE_DIR} + ${QT_QTCORE_INCLUDE_DIR} + ${QT_QTDESIGNER_INCLUDE_DIR} + ${QT_QTGUI_INCLUDE_DIR} + ${QT_QTMOTIF_INCLUDE_DIR} + ${QT_QTNETWORK_INCLUDE_DIR} + ${QT_QTNSPLUGIN_INCLUDE_DIR} + ${QT_QTOPENGL_INCLUDE_DIR} + ${QT_QTSQL_INCLUDE_DIR} + ${QT_QTXML_INCLUDE_DIR} ) + + +######################################## +# +# Setting the LIBRARY-Variables +# +######################################## +IF(NOT QT_QTCORE_LIBRARY) + EXEC_PROGRAM( qmake + ARGS "-query QT_INSTALL_LIBS" + OUTPUT_VARIABLE qt_libs ) + # Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of the filename + FIND_LIBRARY( QT_QTCORE_LIBRARY + NAMES QtCore + PATHS + ${qt_libs} + $ENV{QTDIR}/lib + /usr/local/qt/lib + /usr/local/lib + /usr/lib/qt/lib + /usr/lib + /usr/share/qt4/lib + C:/Progra~1/qt/lib + /usr/lib/qt4 ) +ENDIF(NOT QT_QTCORE_LIBRARY) + +# Set QT_QTCORE_LIBRARY_DEBUG by searching for a lib with "QtCore_debug" as part of the filename +IF(NOT QT_QTCORE_LIBRARY_DEBUG) + EXEC_PROGRAM( qmake + ARGS "-query QT_INSTALL_LIBS" + OUTPUT_VARIABLE qt_libs ) + FIND_LIBRARY( QT_QTCORE_LIBRARY_DEBUG + NAMES QtCore_debug + PATHS + ${qt_libs} + $ENV{QTDIR}/lib + /usr/local/qt/lib + /usr/local/lib + /usr/lib/qt/lib + /usr/lib + /usr/share/qt4/lib + C:/Progra~1/qt/lib + /usr/lib/qt4 ) +ENDIF(NOT QT_QTCORE_LIBRARY_DEBUG) + +# Set QT_LIBRARY_DIR +IF(NOT QT_LIBRARY_DIR) + IF( QT_QTCORE_LIBRARY ) + STRING(REGEX MATCH "[^/]*$" qt_qtcore "${QT_QTCORE_LIBRARY}") + STRING(REGEX REPLACE "/${qt_qtcore}" "" QT_LIBRARY_DIR "${QT_QTCORE_LIBRARY}") + ELSE( QT_QTCORE_LIBRARY ) + IF( QT_QTCORE_LIBRARY_DEBUG ) + STRING(REGEX MATCH "[^/]*$" qt_qtcore_debug "${QT_QTCORE_LIBRARY_DEBUG}") + STRING(REGEX REPLACE "/${qt_qtcore_debug}" "" QT_LIBRARY_DIR "${QT_QTCORE_LIBRARY_DEBUG}") + ENDIF( QT_QTCORE_LIBRARY_DEBUG ) + ENDIF( QT_QTCORE_LIBRARY ) +ENDIF(NOT QT_LIBRARY_DIR) + + +# Set QT_QT3SUPPORT_LIBRARY +IF(NOT QT_QT3SUPPORT_LIBRARY) + FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY Qt3Support ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QT3SUPPORT_LIBRARY) +IF(NOT QT_QT3SUPPORT_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG Qt3Support_debug ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QT3SUPPORT_LIBRARY_DEBUG) + +# Set QT_QTASSISTANT_LIBRARY +IF(NOT QT_QTASSISTANT_LIBRARY) + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY QtAssistant ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTASSISTANT_LIBRARY) +IF(NOT QT_QTASSISTANT_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG QtAssistant_debug ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTASSISTANT_LIBRARY_DEBUG) + +# Set QT_QTDESIGNER_LIBRARY +IF(NOT QT_QTDESIGNER_LIBRARY) + FIND_LIBRARY(QT_QTDESIGNER_LIBRARY QtDesigner ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTDESIGNER_LIBRARY) +IF(NOT QT_QTDESIGNER_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG QtDesigner_debug ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTDESIGNER_LIBRARY_DEBUG) + +# Set QT_QTGUI_LIBRARY +IF(NOT QT_QTGUI_LIBRARY) + FIND_LIBRARY(QT_QTGUI_LIBRARY QtGui ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTGUI_LIBRARY) +IF(NOT QT_QTGUI_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG QtGui_debug ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTGUI_LIBRARY_DEBUG) + +# Set QT_QTMOTIF_LIBRARY +IF(NOT QT_QTMOTIF_LIBRARY) + FIND_LIBRARY(QT_QTMOTIF_LIBRARY QtMotif ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTMOTIF_LIBRARY) +IF(NOT QT_QTMOTIF_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QTMOTIF_LIBRARY_DEBUG QtMotif_debug ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTMOTIF_LIBRARY_DEBUG) + +# Set QT_QTNETWORK_LIBRARY +IF(NOT QT_QTNETWORK_LIBRARY) + FIND_LIBRARY(QT_QTNETWORK_LIBRARY QtNetwork ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTNETWORK_LIBRARY) +IF(NOT QT_QTNETWORK_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG QtNetwork_debug ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTNETWORK_LIBRARY_DEBUG) + +# Set QT_QTNSPLUGIN_LIBRARY +IF(NOT QT_QTNSPLUGIN_LIBRARY) + FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY QtNsPlugin ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTNSPLUGIN_LIBRARY) +IF(NOT QT_QTNSPLUGIN_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_DEBUG QtNsPlugin_debug ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTNSPLUGIN_LIBRARY_DEBUG) + +# Set QT_QTOPENGL_LIBRARY +IF(NOT QT_QTOPENGL_LIBRARY) + FIND_LIBRARY(QT_QTOPENGL_LIBRARY QtOpenGL ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTOPENGL_LIBRARY) +IF(NOT QT_QTOPENGL_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG QtOpenGL_debug ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTOPENGL_LIBRARY_DEBUG) + +# Set QT_QTSQL_LIBRARY +IF(NOT QT_QTSQL_LIBRARY) + FIND_LIBRARY(QT_QTSQL_LIBRARY QtSql ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTSQL_LIBRARY) +IF(NOT QT_QTSQL_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG QtSql_debug ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTSQL_LIBRARY_DEBUG) + +# Set QT_QTXML_LIBRARY +IF(NOT QT_QTXML_LIBRARY) + FIND_LIBRARY(QT_QTXML_LIBRARY QtXml ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTXML_LIBRARY) +IF(NOT QT_QTXML_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG QtXml_debug ${QT_LIBRARY_DIR}) +ENDIF(NOT QT_QTXML_LIBRARY_DEBUG) + +# Make variables changeble to the advanced user +MARK_AS_ADVANCED( + QT_QT3SUPPORT_LIBRARY + QT_QTASSISTANT_LIBRARY + QT_QTCORE_LIBRARY + QT_QTDESIGNER_LIBRARY + QT_QTGUI_LIBRARY + QT_QTMOTIF_LIBRARY + QT_QTNETWORK_LIBRARY + QT_QTNSPLUGIN_LIBRARY + QT_QTOPENGL_LIBRARY + QT_QTSQL_LIBRARY + QT_QTXML_LIBRARY ) + +# Set QT_LIBRARIES +SET( QT_LIBRARIES + ${QT_QT3SUPPORT_LIBRARY} + ${QT_QTASSISTANT_LIBRARY} + ${QT_QTCORE_LIBRARY} + ${QT_QTDESIGNER_LIBRARY} + ${QT_QTGUI_LIBRARY} + ${QT_QTMOTIF_LIBRARY} + ${QT_QTNETWORK_LIBRARY} + ${QT_QTNSPLUGIN_LIBRARY} + ${QT_QTOPENGL_LIBRARY} + ${QT_QTSQL_LIBRARY} + ${QT_QTXML_LIBRARY} ) + +# Make variables changeble to the advanced user +MARK_AS_ADVANCED( + QT_QT3SUPPORT_LIBRARY_DEBUG + QT_QTASSISTANT_LIBRARY_DEBUG + QT_QTCORE_LIBRARY_DEBUG + QT_QTDESIGNER_LIBRARY_DEBUG + QT_QTGUI_LIBRARY_DEBUG + QT_QTMOTIF_LIBRARY_DEBUG + QT_QTNETWORK_LIBRARY_DEBUG + QT_QTNSPLUGIN_LIBRARY_DEBUG + QT_QTOPENGL_LIBRARY_DEBUG + QT_QTSQL_LIBRARY_DEBUG + QT_QTXML_LIBRARY_DEBUG ) + +# Set QT_LIBRARIES_DEBUG +SET( QT_LIBRARIES_DEBUG + ${QT_QT3SUPPORT_LIBRARY_DEBUG} + ${QT_QTASSISTANT_LIBRARY_DEBUG} + ${QT_QTCORE_LIBRARY_DEBUG} + ${QT_QTDESIGNER_LIBRARY_DEBUG} + ${QT_QTGUI_LIBRARY_DEBUG} + ${QT_QTMOTIF_LIBRARY_DEBUG} + ${QT_QTNETWORK_LIBRARY_DEBUG} + ${QT_QTNSPLUGIN_LIBRARY_DEBUG} + ${QT_QTOPENGL_LIBRARY_DEBUG} + ${QT_QTSQL_LIBRARY_DEBUG} + ${QT_QTXML_LIBRARY_DEBUG} ) + +# Set QT_LIBRARIES_TRYOPTIMIZED +IF(NOT QT_LIBRARIES_TRYOPTIMIZED) + IF(QT_QT3SUPPORT_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QT3SUPPORT_LIBRARY} ) + ELSE(QT_QT3SUPPORT_LIBRARY) + IF(QT_QT3SUPPORT_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QT3SUPPORT_LIBRARY_DEBUG} ) + ENDIF(QT_QT3SUPPORT_LIBRARY_DEBUG) + ENDIF(QT_QT3SUPPORT_LIBRARY) + + IF(QT_QTASSISTANT_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTASSISTANT_LIBRARY} ) + ELSE(QT_QTASSISTANT_LIBRARY) + IF(QT_QTASSISTANT_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTASSISTANT_LIBRARY_DEBUG} ) + ENDIF(QT_QTASSISTANT_LIBRARY_DEBUG) + ENDIF(QT_QTASSISTANT_LIBRARY) + + IF(QT_QTCORE_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTCORE_LIBRARY} ) + ELSE(QT_QTCORE_LIBRARY) + IF(QT_QTCORE_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTCORE_LIBRARY_DEBUG} ) + ENDIF(QT_QTCORE_LIBRARY_DEBUG) + ENDIF(QT_QTCORE_LIBRARY) + + IF(QT_QTDESIGNER_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTDESIGNER_LIBRARY} ) + ELSE(QT_QTDESIGNER_LIBRARY) + IF(QT_QTDESIGNER_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTDESIGNER_LIBRARY_DEBUG} ) + ENDIF(QT_QTDESIGNER_LIBRARY_DEBUG) + ENDIF(QT_QTDESIGNER_LIBRARY) + + IF(QT_QTGUI_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTGUI_LIBRARY} ) + ELSE(QT_QTGUI_LIBRARY) + IF(QT_QTGUI_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTGUI_LIBRARY_DEBUG} ) + ENDIF(QT_QTGUI_LIBRARY_DEBUG) + ENDIF(QT_QTGUI_LIBRARY) + + IF(QT_QTMOTIF_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTMOTIF_LIBRARY} ) + ELSE(QT_QTMOTIF_LIBRARY) + IF(QT_QTMOTIF_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTMOTIF_LIBRARY_DEBUG} ) + ENDIF(QT_QTMOTIF_LIBRARY_DEBUG) + ENDIF(QT_QTMOTIF_LIBRARY) + + IF(QT_QTNETWORK_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTNETWORK_LIBRARY} ) + ELSE(QT_QTNETWORK_LIBRARY) + IF(QT_QTNETWORK_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTNETWORK_LIBRARY_DEBUG} ) + ENDIF(QT_QTNETWORK_LIBRARY_DEBUG) + ENDIF(QT_QTNETWORK_LIBRARY) + + IF(QT_QTNSPLUGIN_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTNSPLUGIN_LIBRARY} ) + ELSE(QT_QTNSPLUGIN_LIBRARY) + IF(QT_QTNSPLUGIN_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTNSPLUGIN_LIBRARY_DEBUG} ) + ENDIF(QT_QTNSPLUGIN_LIBRARY_DEBUG) + ENDIF(QT_QTNSPLUGIN_LIBRARY) + + IF(QT_QTOPENGL_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTOPENGL_LIBRARY} ) + ELSE(QT_QTOPENGL_LIBRARY) + IF(QT_QTOPENGL_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTOPENGL_LIBRARY_DEBUG} ) + ENDIF(QT_QTOPENGL_LIBRARY_DEBUG) + ENDIF(QT_QTOPENGL_LIBRARY) + + IF(QT_QTSQL_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTSQL_LIBRARY} ) + ELSE(QT_QTSQL_LIBRARY) + IF(QT_QTSQL_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTSQL_LIBRARY_DEBUG} ) + ENDIF(QT_QTSQL_LIBRARY_DEBUG) + ENDIF(QT_QTSQL_LIBRARY) + + IF(QT_QTXML_LIBRARY) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTXML_LIBRARY} ) + ELSE(QT_QTXML_LIBRARY) + IF(QT_QTXML_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYOPTIMIZED ${QT_LIBRARIES_TRYOPTIMIZED} ${QT_QTXML_LIBRARY_DEBUG} ) + ENDIF(QT_QTXML_LIBRARY_DEBUG) + ENDIF(QT_QTXML_LIBRARY) +ENDIF(NOT QT_LIBRARIES_TRYOPTIMIZED) + +# Set QT_LIBRARIES_TRYDEBUG +IF(NOT QT_LIBRARIES_TRYDEBUG) + IF(QT_QT3SUPPORT_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QT3SUPPORT_LIBRARY_DEBUG} ) + ELSE(QT_QT3SUPPORT_LIBRARY_DEBUG) + IF(QT_QT3SUPPORT_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QT3SUPPORT_LIBRARY} ) + ENDIF(QT_QT3SUPPORT_LIBRARY) + ENDIF(QT_QT3SUPPORT_LIBRARY_DEBUG) + + IF(QT_QTASSISTANT_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTASSISTANT_LIBRARY_DEBUG} ) + ELSE(QT_QTASSISTANT_LIBRARY_DEBUG) + IF(QT_QTASSISTANT_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTASSISTANT_LIBRARY} ) + ENDIF(QT_QTASSISTANT_LIBRARY) + ENDIF(QT_QTASSISTANT_LIBRARY_DEBUG) + + IF(QT_QTCORE_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTCORE_LIBRARY_DEBUG} ) + ELSE(QT_QTCORE_LIBRARY_DEBUG) + IF(QT_QTCORE_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTCORE_LIBRARY} ) + ENDIF(QT_QTCORE_LIBRARY) + ENDIF(QT_QTCORE_LIBRARY_DEBUG) + + IF(QT_QTDESIGNER_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTDESIGNER_LIBRARY_DEBUG} ) + ELSE(QT_QTDESIGNER_LIBRARY_DEBUG) + IF(QT_QTDESIGNER_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTDESIGNER_LIBRARY} ) + ENDIF(QT_QTDESIGNER_LIBRARY) + ENDIF(QT_QTDESIGNER_LIBRARY_DEBUG) + + IF(QT_QTGUI_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTGUI_LIBRARY_DEBUG} ) + ELSE(QT_QTGUI_LIBRARY_DEBUG) + IF(QT_QTGUI_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTGUI_LIBRARY} ) + ENDIF(QT_QTGUI_LIBRARY) + ENDIF(QT_QTGUI_LIBRARY_DEBUG) + + IF(QT_QTMOTIF_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTMOTIF_LIBRARY_DEBUG} ) + ELSE(QT_QTMOTIF_LIBRARY_DEBUG) + IF(QT_QTMOTIF_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTMOTIF_LIBRARY} ) + ENDIF(QT_QTMOTIF_LIBRARY) + ENDIF(QT_QTMOTIF_LIBRARY_DEBUG) + + IF(QT_QTNETWORK_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTNETWORK_LIBRARY_DEBUG} ) + ELSE(QT_QTNETWORK_LIBRARY_DEBUG) + IF(QT_QTNETWORK_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTNETWORK_LIBRARY} ) + ENDIF(QT_QTNETWORK_LIBRARY) + ENDIF(QT_QTNETWORK_LIBRARY_DEBUG) + + IF(QT_QTNSPLUGIN_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTNSPLUGIN_LIBRARY_DEBUG} ) + ELSE(QT_QTNSPLUGIN_LIBRARY_DEBUG) + IF(QT_QTNSPLUGIN_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTNSPLUGIN_LIBRARY} ) + ENDIF(QT_QTNSPLUGIN_LIBRARY) + ENDIF(QT_QTNSPLUGIN_LIBRARY_DEBUG) + + IF(QT_QTOPENGL_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTOPENGL_LIBRARY_DEBUG} ) + ELSE(QT_QTOPENGL_LIBRARY_DEBUG) + IF(QT_QTOPENGL_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTOPENGL_LIBRARY} ) + ENDIF(QT_QTOPENGL_LIBRARY) + ENDIF(QT_QTOPENGL_LIBRARY_DEBUG) + + IF(QT_QTSQL_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTSQL_LIBRARY_DEBUG} ) + ELSE(QT_QTSQL_LIBRARY_DEBUG) + IF(QT_QTSQL_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTSQL_LIBRARY} ) + ENDIF(QT_QTSQL_LIBRARY) + ENDIF(QT_QTSQL_LIBRARY_DEBUG) + + IF(QT_QTXML_LIBRARY_DEBUG) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTXML_LIBRARY_DEBUG} ) + ELSE(QT_QTXML_LIBRARY_DEBUG) + IF(QT_QTXML_LIBRARY) + SET( QT_LIBRARIES_TRYDEBUG ${QT_LIBRARIES_TRYDEBUG} ${QT_QTXML_LIBRARY} ) + ENDIF(QT_QTXML_LIBRARY) + ENDIF(QT_QTXML_LIBRARY_DEBUG) +ENDIF(NOT QT_LIBRARIES_TRYDEBUG) + + +####################################### +# +# Check the executables of Qt +# ( moc, uic, rcc ) +# +####################################### +IF(NOT QT_MOC_EXECUTABLE) + EXEC_PROGRAM( qmake + ARGS "-query QT_INSTALL_BINS" + OUTPUT_VARIABLE qt_bins ) + + FIND_PROGRAM(QT_MOC_EXECUTABLE + NAMES moc + PATHS + ${qt_bins} + $ENV{QTDIR}/bin + /usr/local/qt/bin + /usr/local/bin + /usr/lib/qt/bin + /usr/bin + /usr/share/qt4/bin + C:/Progra~1/qt/bin + /usr/bin/qt4 + ) +ENDIF(NOT QT_MOC_EXECUTABLE) + +IF(QT_MOC_EXECUTABLE) + SET ( QT_WRAP_CPP "YES") +ELSE(QT_MOC_EXECUTABLE) +ENDIF(QT_MOC_EXECUTABLE) + +IF(NOT QT_UIC_EXECUTABLE ) + EXEC_PROGRAM( qmake + ARGS "-query QT_INSTALL_BINS" + OUTPUT_VARIABLE qt_bins ) + FIND_PROGRAM(QT_UIC_EXECUTABLE + NAMES uic + PATHS + ${qt_bins} + $ENV{QTDIR}/bin + /usr/local/qt/bin + /usr/local/bin + /usr/lib/qt/bin + /usr/bin + /usr/share/qt4/bin + C:/Progra~1/qt/bin + /usr/bin/qt4 + ) +ENDIF(NOT QT_UIC_EXECUTABLE ) + +IF(QT_UIC_EXECUTABLE) + SET ( QT_WRAP_UI "YES") +ELSE(QT_UIC_EXECUTABLE) +ENDIF(QT_UIC_EXECUTABLE) + +IF(NOT QT_RCC_EXECUTABLE) + EXEC_PROGRAM( qmake + ARGS "-query QT_INSTALL_BINS" + OUTPUT_VARIABLE qt_bins ) + FIND_PROGRAM(QT_RCC_EXECUTABLE + NAMES rcc + PATHS + ${qt_bins} + $ENV{QTDIR}/bin + /usr/local/qt/bin + /usr/local/bin + /usr/lib/qt/bin + /usr/bin + /usr/share/qt4/bin + C:/Progra~1/qt/bin + /usr/bin/qt4 + ) +ENDIF(NOT QT_RCC_EXECUTABLE ) + +MARK_AS_ADVANCED( + QT_UIC_EXECUTABLE + QT_MOC_EXECUTABLE + QT_RCC_EXECUTABLE ) + +###################################### +# +# deside if Qt got found +# +###################################### +# if the includes,libraries,moc,uic and rcc are found then we have it +IF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE) + SET( QT_FOUND "YES" ) + IF( NOT Qt_FIND_QUIETLY) + MESSAGE(STATUS "Found Qt-Version ${QT_INST_MAJOR_VERSION}.${QT_INST_MINOR_VERSION}.${QT_INST_PATCH_VERSION}") + ENDIF( NOT Qt_FIND_QUIETLY) +ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE) + SET( QT_FOUND "NO") + IF( Qt_FIND_REQUIRED) + MESSAGE( SEND_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!") + ENDIF( Qt_FIND_REQUIRED) +ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE) + + +####################################### +# +# System dependent settings +# +####################################### +# for unix add X11 stuff +IF(UNIX) + FIND_PACKAGE(X11) + IF (X11_FOUND) + SET (QT_LIBRARIES ${QT_LIBRARIES} ${X11_LIBRARIES}) + ENDIF (X11_FOUND) + IF (CMAKE_DL_LIBS) + SET (QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_DL_LIBS}) + ENDIF (CMAKE_DL_LIBS) +ENDIF(UNIX) + + +####################################### +# +# compatibility settings +# +####################################### +# Backwards compatibility for CMake1.4 and 1.2 +SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) +SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) + +SET( QT_DEFINITIONS "") +SET( QT_QT_LIBRARY "") +SET( QT_QTMAIN_LIBRARY "") + |