diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2005-09-12 13:00:55 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2005-09-12 13:00:55 (GMT) |
commit | f52977a9f79bcc4e9a7f6edd099a9e06c71b8b25 (patch) | |
tree | fc066c19fd0d9de72ec7c94ee4a180112964fd8f | |
parent | b6880f295d49f31156339f26bd17b25a3d7cbca3 (diff) | |
download | CMake-f52977a9f79bcc4e9a7f6edd099a9e06c71b8b25.zip CMake-f52977a9f79bcc4e9a7f6edd099a9e06c71b8b25.tar.gz CMake-f52977a9f79bcc4e9a7f6edd099a9e06c71b8b25.tar.bz2 |
ENH: make sure the correct qmake is used
-rw-r--r-- | Modules/FindQt.cmake | 4 | ||||
-rw-r--r-- | Modules/FindQt4.cmake | 1109 |
2 files changed, 561 insertions, 552 deletions
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 4074443..0e3e874 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -41,7 +41,7 @@ ENDIF(GLOB_TEMP_VAR) SET(GLOB_TEMP_VAR) # now find qmake -FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin") +FIND_PROGRAM(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin") IF(QT_QMAKE_EXECUTABLE) EXEC_PROGRAM(${QMAKE_PATH} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) @@ -131,4 +131,4 @@ ELSE(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) ENDIF(QT_REQUIRED) ENDIF(NOT QT_FOUND AND DESIRED_QT_VERSION) ENDIF(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) -MARK_AS_ADVANCED(QT3_QGLOBAL_H_FILE QT4_QGLOBAL_H_FILE QT_QMAKE_EXECUTABLE) +MARK_AS_ADVANCED(QT3_QGLOBAL_H_FILE QT4_QGLOBAL_H_FILE QT_QMAKE_EXECUTABLE_FINDQT) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index c12ec3b..3ef7c65 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -117,577 +117,586 @@ ENDIF(WIN32) # check for qmake FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS - $ENV{QTDIR}/bin "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" + $ENV{QTDIR}/bin ) - -# Set QT_LIBRARY_DIR -IF(NOT QT_LIBRARY_DIR) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_LIBS" - OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP ) - SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir") -ENDIF(NOT QT_LIBRARY_DIR) - -IF (APPLE) - IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - SET(QT_USE_FRAMEWORKS ON - CACHE BOOL "Set to ON if Qt build uses frameworks.") - ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - SET(QT_USE_FRAMEWORKS OFF - CACHE BOOL "Set to ON if Qt build uses frameworks.") - ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - - MARK_AS_ADVANCED(QT_USE_FRAMEWORKS) -ENDIF (APPLE) - -######################################## -# -# Setting the INCLUDE-Variables -# -######################################## -IF (NOT QT_HEADERS_DIR) - # Set QT_QT_INCLUDE_DIR by searching for qglobal.h - IF(QT_QMAKE_EXECUTABLE) +IF(QT_QMAKE_EXECUTABLE) + EXEC_PROGRAM(${QMAKE_PATH} ARGS "-query QT_VERSION" + OUTPUT_VARIABLE QTVERSION) + IF(QTVERSION MATCHES "4.*") + SET(QT4_QMAKE_FOUND TRUE) + ENDIF(QTVERSION MATCHES "4.*") +ENDIF(QT_QMAKE_EXECUTABLE) +IF(QT4_QMAKE_FOUND) + # Set QT_LIBRARY_DIR + IF(NOT QT_LIBRARY_DIR) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_HEADERS" - OUTPUT_VARIABLE qt_headers ) - SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "") - ENDIF(QT_QMAKE_EXECUTABLE) -ENDIF (NOT QT_HEADERS_DIR) -FIND_PATH( QT_QT_INCLUDE_DIR qglobal.h - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/include/Qt" - ${QT_HEADERS_DIR}/Qt - ${QT_LIBRARY_DIR}/QtCore.framework/Headers - $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:/Program Files/qt/include/Qt" - /usr/include/qt4/Qt) - -# Set QT_INCLUDE_DIR by removine "/Qt" in the string ${QT_QT_INCLUDE_DIR} -IF( QT_QT_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) - IF (QT_USE_FRAMEWORKS) - SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR}) - ELSE (QT_USE_FRAMEWORKS) - STRING( REGEX REPLACE "/Qt$" "" qt4_include_dir ${QT_QT_INCLUDE_DIR}) - SET( QT_INCLUDE_DIR ${qt4_include_dir} CACHE PATH "") - ENDIF (QT_USE_FRAMEWORKS) -ENDIF( QT_QT_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) -IF( 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( NOT QT_INCLUDE_DIR) - -IF (QT_USE_FRAMEWORKS) - SET(QT_DEFINITIONS ${QT_DEFINITIONS} - -F${QT_LIBRARY_DIR} - ) -ENDIF (QT_USE_FRAMEWORKS) - -# Set QT_QT3SUPPORT_INCLUDE_DIR -FIND_PATH( QT_QT3SUPPORT_INCLUDE_DIR Qt3Support - ${QT_INCLUDE_DIR}/Qt3Support - ${QT_LIBRARY_DIR}/Qt3Support.framework/Headers - ) - -# Set QT_QTCORE_INCLUDE_DIR -FIND_PATH( QT_QTCORE_INCLUDE_DIR QtCore - ${QT_INCLUDE_DIR}/QtCore - ${QT_LIBRARY_DIR}/QtCore.framework/Headers - ) - -# Set QT_QTGUI_INCLUDE_DIR -FIND_PATH( QT_QTGUI_INCLUDE_DIR QtGui - ${QT_INCLUDE_DIR}/QtGui - ${QT_LIBRARY_DIR}/QtGui.framework/Headers - ) - -# Set QT_QTMOTIF_INCLUDE_DIR -FIND_PATH( QT_QTMOTIF_INCLUDE_DIR QtMotif ${QT_INCLUDE_DIR}/QtMotif) - -# Set QT_QTNETWORK_INCLUDE_DIR -FIND_PATH( QT_QTNETWORK_INCLUDE_DIR QtNetwork - ${QT_INCLUDE_DIR}/QtNetwork - ${QT_LIBRARY_DIR}/QtNetwork.framework/Headers - ) - -# Set QT_QTNSPLUGIN_INCLUDE_DIR -FIND_PATH( QT_QTNSPLUGIN_INCLUDE_DIR QtNsPlugin - ${QT_INCLUDE_DIR}/QtNsPlugin - ${QT_LIBRARY_DIR}/QtNsPlugin.framework/Headers - ) - -# Set QT_QTOPENGL_INCLUDE_DIR -FIND_PATH( QT_QTOPENGL_INCLUDE_DIR QtOpenGL - ${QT_INCLUDE_DIR}/QtOpenGL - ${QT_LIBRARY_DIR}/QtOpenGL.framework/Headers - ) - -# Set QT_QTSQL_INCLUDE_DIR -FIND_PATH( QT_QTSQL_INCLUDE_DIR QtSql - ${QT_INCLUDE_DIR}/QtSql - ${QT_LIBRARY_DIR}/QtSql.framework/Headers - ) - -# Set QT_QTXML_INCLUDE_DIR -FIND_PATH( QT_QTXML_INCLUDE_DIR QtXml - ${QT_INCLUDE_DIR}/QtXml - ${QT_LIBRARY_DIR}/QtXml.framework/Headers - ) - -# Set QT_QTASSISTANT_INCLUDE_DIR -FIND_PATH( QT_QTASSISTANT_INCLUDE_DIR QtAssistant - ${QT_INCLUDE_DIR}/QtAssistant - ${QT_HEADERS_DIR}/QtAssistant - ) - -# Set QT_QTDESIGNER_INCLUDE_DIR -FIND_PATH( QT_QTDESIGNER_INCLUDE_DIR QDesignerComponents - ${QT_INCLUDE_DIR}/QtDesigner - ${QT_HEADERS_DIR}/QtDesigner - ) - -# Make variables changeble to the advanced user -MARK_AS_ADVANCED( - QT_LIBRARY_DIR - 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_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 (QT_USE_FRAMEWORKS) - # If FIND_LIBRARY found libraries in Apple frameworks, we would not have - # to jump through these hoops. - SET(QT_QTCORE_LIBRARY "-F${QT_LIBRARY_DIR} -framework QtCore" - CACHE STRING "The QtCore library.") - SET(QT_QTCORE_LIBRARY_DEBUG "-F${QT_LIBRARY_DIR} -framework QtCore" - CACHE STRING "The QtCore library.") - SET(QT_QT3SUPPORT_LIBRARY "-framework Qt3Support" - CACHE STRING "The Qt3Support library.") - SET(QT_QT3SUPPORT_LIBRARY_DEBUG "-framework Qt3Support" - CACHE STRING "The Qt3Support library.") - SET(QT_QTGUI_LIBRARY "-framework QtGui" - CACHE STRING "The QtGui library.") - SET(QT_QTGUI_LIBRARY_DEBUG "-framework QtGui" - CACHE STRING "The QtGui library.") - SET(QT_QTNETWORK_LIBRARY "-framework QtNetwork" - CACHE STRING "The QtNetwork library.") - SET(QT_QTNETWORK_LIBRARY_DEBUG "-framework QtNetwork" - CACHE STRING "The QtNetwork library.") - SET(QT_QTOPENGL_LIBRARY "-framework QtOpenGL" - CACHE STRING "The QtOpenGL library.") - SET(QT_QTOPENGL_LIBRARY_GUI "-framework QtOpenGL" - CACHE STRING "The QtOpenGL library.") - SET(QT_QTSQL_LIBRARY "-framework QtSql" - CACHE STRING "The QtSql library.") - SET(QT_QTSQL_LIBRARY_DEBUG "-framework QtSql" - CACHE STRING "The QtSql library.") - SET(QT_QTXML_LIBRARY "-framework QtXml" - CACHE STRING "The QtXml library.") - SET(QT_QTXML_LIBRARY_DEBUG "-framework QtXml" - CACHE STRING "The QtXml library.") -ELSE (QT_USE_FRAMEWORKS) + ARGS "-query QT_INSTALL_LIBS" + OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP ) + SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir") + ENDIF(NOT QT_LIBRARY_DIR) - # Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of - # the filename - FIND_LIBRARY( QT_QTCORE_LIBRARY - NAMES QtCore QtCore4 - PATHS - ${QT_LIBRARY_DIR} - $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 ) - - # Set QT_QTCORE_LIBRARY_DEBUG by searching for a lib with "QtCore_debug" - # as part of the filename - FIND_LIBRARY( QT_QTCORE_LIBRARY_DEBUG - NAMES QtCore_debug QtCored4 - PATHS - ${QT_LIBRARY_DIR} - $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 ) - - # Set QT_QT3SUPPORT_LIBRARY - FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR}) - FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG NAMES Qt3Support_debug Qt3Supportd4 PATHS ${QT_LIBRARY_DIR}) - - # Set QT_QTGUI_LIBRARY - FIND_LIBRARY(QT_QTGUI_LIBRARY NAMES QtGui QtGui4 PATHS ${QT_LIBRARY_DIR}) - FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG NAMES QtGui_debug QtGuid4 PATHS ${QT_LIBRARY_DIR}) - - # Set QT_QTMOTIF_LIBRARY - FIND_LIBRARY(QT_QTMOTIF_LIBRARY NAMES QtMotif PATHS ${QT_LIBRARY_DIR}) - FIND_LIBRARY(QT_QTMOTIF_LIBRARY_DEBUG NAMES QtMotif_debug PATHS ${QT_LIBRARY_DIR}) - - # Set QT_QTNETWORK_LIBRARY - FIND_LIBRARY(QT_QTNETWORK_LIBRARY NAMES QtNetwork QtNetwork4 PATHS ${QT_LIBRARY_DIR}) - FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG NAMES QtNetwork_debug QtNetworkd4 PATHS ${QT_LIBRARY_DIR}) - - # Set QT_QTNSPLUGIN_LIBRARY - FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY NAMES QtNsPlugin PATHS ${QT_LIBRARY_DIR}) - FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_DEBUG NAMES QtNsPlugin_debug PATHS ${QT_LIBRARY_DIR}) - - # Set QT_QTOPENGL_LIBRARY - FIND_LIBRARY(QT_QTOPENGL_LIBRARY NAMES QtOpenGL QtOpenGL4 PATHS ${QT_LIBRARY_DIR}) - FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG NAMES QtOpenGL_debug QtOpenGLd4 PATHS ${QT_LIBRARY_DIR}) - - # Set QT_QTSQL_LIBRARY - FIND_LIBRARY(QT_QTSQL_LIBRARY NAMES QtSql QtSql4 PATHS ${QT_LIBRARY_DIR}) - FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG NAMES QtSql_debug QtSqld4 PATHS ${QT_LIBRARY_DIR}) - - # Set QT_QTXML_LIBRARY - FIND_LIBRARY(QT_QTXML_LIBRARY NAMES QtXml QtXml4 PATHS ${QT_LIBRARY_DIR}) - FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG NAMES QtXml_debug QtXmld4 PATHS ${QT_LIBRARY_DIR}) - -ENDIF (QT_USE_FRAMEWORKS) - -# Set QT_QTASSISTANT_LIBRARY -FIND_LIBRARY(QT_QTASSISTANT_LIBRARY NAMES QtAssistant QtAssistant4 PATHS ${QT_LIBRARY_DIR}) -FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistant_debug QtAssistantd4 PATHS ${QT_LIBRARY_DIR}) - -# Set QT_QTDESIGNER_LIBRARY -FIND_LIBRARY(QT_QTDESIGNER_LIBRARY NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR}) -FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG NAMES QtDesigner_debug QtDesignerd4 PATHS ${QT_LIBRARY_DIR}) - -# 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 ) - -# 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 ) - -############################################ -# -# Check the existence of the libraries. -# -############################################ - -IF (QT_QTCORE_INCLUDE_DIR AND QT_QTCORE_LIBRARY) - SET(QT_QTCORE_FOUND 1) - IF (NOT QT_QTCORE_LIBRARY_DEBUG) - SET(QT_QTCORE_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY}) - ENDIF (NOT QT_QTCORE_LIBRARY_DEBUG) -ENDIF (QT_QTCORE_INCLUDE_DIR AND QT_QTCORE_LIBRARY) - -IF (QT_QTGUI_INCLUDE_DIR AND QT_QTGUI_LIBRARY) - SET(QT_QTGUI_FOUND 1) - IF (NOT QT_QTGUI_LIBRARY_DEBUG) - SET(QT_QTGUI_LIBRARY_DEBUG ${QT_QTGUI_LIBRARY}) - ENDIF (NOT QT_QTGUI_LIBRARY_DEBUG) -ENDIF (QT_QTGUI_INCLUDE_DIR AND QT_QTGUI_LIBRARY) - -IF (QT_QT3SUPPORT_INCLUDE_DIR AND QT_QT3SUPPORT_LIBRARY) - SET(QT_QT3SUPPORT_FOUND 1) - IF (NOT QT_QT3SUPPORT_LIBRARY_DEBUG) - SET(QT_QT3SUPPORT_LIBRARY_DEBUG ${QT_QT3SUPPORT_LIBRARY}) - ENDIF (NOT QT_QT3SUPPORT_LIBRARY_DEBUG) -ENDIF (QT_QT3SUPPORT_INCLUDE_DIR AND QT_QT3SUPPORT_LIBRARY) - -IF (QT_QTASSISTANT_INCLUDE_DIR AND QT_QTASSISTANT_LIBRARY) - SET(QT_QTASSISTANT_FOUND 1) - IF (NOT QT_QTASSISTANT_LIBRARY_DEBUG) - SET(QT_QTASSISTANT_LIBRARY_DEBUG ${QT_QTASSISTANT_LIBRARY}) - ENDIF (NOT QT_QTASSISTANT_LIBRARY_DEBUG) -ENDIF (QT_QTASSISTANT_INCLUDE_DIR AND QT_QTASSISTANT_LIBRARY) - -IF (QT_QTDESIGNER_INCLUDE_DIR AND QT_QTDESIGNER_LIBRARY) - SET(QT_QTDESIGNER_FOUND 1) - IF (NOT QT_QTDESIGNER_LIBRARY_DEBUG) - SET(QT_QTDESIGNER_LIBRARY_DEBUG ${QT_QTDESIGNER_LIBRARY}) - ENDIF (NOT QT_QTDESIGNER_LIBRARY_DEBUG) -ENDIF (QT_QTDESIGNER_INCLUDE_DIR AND QT_QTDESIGNER_LIBRARY) - -IF (QT_QTMOTIF_INCLUDE_DIR AND QT_QTMOTIF_LIBRARY) - SET(QT_QTMOTIF_FOUND 1) - IF (NOT QT_QTMOTIF_LIBRARY_DEBUG) - SET(QT_QTMOTIF_LIBRARY_DEBUG ${QT_QTMOTIF_LIBRARY}) - ENDIF (NOT QT_QTMOTIF_LIBRARY_DEBUG) -ENDIF (QT_QTMOTIF_INCLUDE_DIR AND QT_QTMOTIF_LIBRARY) - -IF (QT_QTNETWORK_INCLUDE_DIR AND QT_QTNETWORK_LIBRARY) - SET(QT_QTNETWORK_FOUND 1) - IF (NOT QT_QTNETWORK_LIBRARY_DEBUG) - SET(QT_QTNETWORK_LIBRARY_DEBUG ${QT_QTNETWORK_LIBRARY}) - ENDIF (NOT QT_QTNETWORK_LIBRARY_DEBUG) -ENDIF (QT_QTNETWORK_INCLUDE_DIR AND QT_QTNETWORK_LIBRARY) - -IF (QT_QTNSPLUGIN_INCLUDE_DIR AND QT_QTNSPLUGIN_LIBRARY) - SET(QT_QTNSPLUGIN_FOUND 1) - IF (NOT QT_QTNSPLUGIN_LIBRARY_DEBUG) - SET(QT_QTNSPLUGIN_LIBRARY_DEBUG ${QT_QTNSPLUGIN_LIBRARY}) - ENDIF (NOT QT_QTNSPLUGIN_LIBRARY_DEBUG) -ENDIF (QT_QTNSPLUGIN_INCLUDE_DIR AND QT_QTNSPLUGIN_LIBRARY) - -IF (QT_QTOPENGL_INCLUDE_DIR AND QT_QTOPENGL_LIBRARY) - SET(QT_QTOPENGL_FOUND 1) - IF (NOT QT_QTOPENGL_LIBRARY_DEBUG) - SET(QT_QTOPENGL_LIBRARY_DEBUG ${QT_QTOPENGL_LIBRARY}) - ENDIF (NOT QT_QTOPENGL_LIBRARY_DEBUG) -ENDIF (QT_QTOPENGL_INCLUDE_DIR AND QT_QTOPENGL_LIBRARY) - -IF (QT_QTSQL_INCLUDE_DIR AND QT_QTSQL_LIBRARY) - SET(QT_QTSQL_FOUND 1) - IF (NOT QT_QTSQL_LIBRARY_DEBUG) - SET(QT_QTSQL_LIBRARY_DEBUG ${QT_QTSQL_LIBRARY}) - ENDIF (NOT QT_QTSQL_LIBRARY_DEBUG) -ENDIF (QT_QTSQL_INCLUDE_DIR AND QT_QTSQL_LIBRARY) - -IF (QT_QTXML_INCLUDE_DIR AND QT_QTXML_LIBRARY) - SET(QT_QTXML_FOUND 1) - IF (NOT QT_QTXML_LIBRARY_DEBUG) - SET(QT_QTXML_LIBRARY_DEBUG ${QT_QTXML_LIBRARY}) - ENDIF (NOT QT_QTXML_LIBRARY_DEBUG) -ENDIF (QT_QTXML_INCLUDE_DIR AND QT_QTXML_LIBRARY) - -####################################### -# -# Check the executables of Qt -# ( moc, uic, rcc ) -# -####################################### -IF (NOT QT_BINARY_DIR) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_BINS" - OUTPUT_VARIABLE qt_bins ) - SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "") -ENDIF (NOT QT_BINARY_DIR) -FIND_PROGRAM(QT_MOC_EXECUTABLE - NAMES moc - PATHS - ${QT_BINARY_DIR} - $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 - ) - -IF(QT_MOC_EXECUTABLE) - SET ( QT_WRAP_CPP "YES") -ENDIF(QT_MOC_EXECUTABLE) - -FIND_PROGRAM(QT_UIC_EXECUTABLE - NAMES uic - PATHS - ${QT_BINARY_DIR} - $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 - ) - -IF(QT_UIC_EXECUTABLE) - SET ( QT_WRAP_UI "YES") -ENDIF(QT_UIC_EXECUTABLE) - -FIND_PROGRAM(QT_RCC_EXECUTABLE - NAMES rcc - PATHS - ${QT_BINARY_DIR} - $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 - ) - -MARK_AS_ADVANCED( - QT_UIC_EXECUTABLE - QT_MOC_EXECUTABLE - QT_RCC_EXECUTABLE ) - -###################################### -# -# Macros for building Qt files -# -###################################### - - -# QT4_WRAP_CPP(outfiles inputfile ... ) -# TODO perhaps add support for -D, -U and other minor options - -MACRO(QT4_WRAP_CPP outfiles ) + IF (APPLE) + IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) + SET(QT_USE_FRAMEWORKS ON + CACHE BOOL "Set to ON if Qt build uses frameworks.") + ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) + SET(QT_USE_FRAMEWORKS OFF + CACHE BOOL "Set to ON if Qt build uses frameworks.") + ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) + + MARK_AS_ADVANCED(QT_USE_FRAMEWORKS) + ENDIF (APPLE) + + ######################################## + # + # Setting the INCLUDE-Variables + # + ######################################## + IF (NOT QT_HEADERS_DIR) + # Set QT_QT_INCLUDE_DIR by searching for qglobal.h + IF(QT_QMAKE_EXECUTABLE) + EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} + ARGS "-query QT_INSTALL_HEADERS" + OUTPUT_VARIABLE qt_headers ) + SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "") + ENDIF(QT_QMAKE_EXECUTABLE) + ENDIF (NOT QT_HEADERS_DIR) + FIND_PATH( QT_QT_INCLUDE_DIR qglobal.h + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/include/Qt" + ${QT_HEADERS_DIR}/Qt + ${QT_LIBRARY_DIR}/QtCore.framework/Headers + $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:/Program Files/qt/include/Qt" + /usr/include/qt4/Qt) + + # Set QT_INCLUDE_DIR by removine "/Qt" in the string ${QT_QT_INCLUDE_DIR} + IF( QT_QT_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) + IF (QT_USE_FRAMEWORKS) + SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR}) + ELSE (QT_USE_FRAMEWORKS) + STRING( REGEX REPLACE "/Qt$" "" qt4_include_dir ${QT_QT_INCLUDE_DIR}) + SET( QT_INCLUDE_DIR ${qt4_include_dir} CACHE PATH "") + ENDIF (QT_USE_FRAMEWORKS) + ENDIF( QT_QT_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) + IF( 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( NOT QT_INCLUDE_DIR) - # get include dirs - GET_DIRECTORY_PROPERTY(moc_includes_tmp INCLUDE_DIRECTORIES) - SET(moc_includes) - FOREACH(it ${moc_includes_tmp}) - SET(moc_includes ${moc_includes} "-I${it}") - ENDFOREACH(it) + IF (QT_USE_FRAMEWORKS) + SET(QT_DEFINITIONS ${QT_DEFINITIONS} + -F${QT_LIBRARY_DIR} + ) + ENDIF (QT_USE_FRAMEWORKS) - FOREACH(it ${ARGN}) - GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) + # Set QT_QT3SUPPORT_INCLUDE_DIR + FIND_PATH( QT_QT3SUPPORT_INCLUDE_DIR Qt3Support + ${QT_INCLUDE_DIR}/Qt3Support + ${QT_LIBRARY_DIR}/Qt3Support.framework/Headers + ) - SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it}) - SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/moc_${outfile}.cxx) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${moc_includes} -o ${outfile} ${infile} - MAIN_DEPENDENCY ${infile}) - SET(${outfiles} ${${outfiles}} ${outfile}) - ENDFOREACH(it) + # Set QT_QTCORE_INCLUDE_DIR + FIND_PATH( QT_QTCORE_INCLUDE_DIR QtCore + ${QT_INCLUDE_DIR}/QtCore + ${QT_LIBRARY_DIR}/QtCore.framework/Headers + ) -ENDMACRO(QT4_WRAP_CPP) + # Set QT_QTGUI_INCLUDE_DIR + FIND_PATH( QT_QTGUI_INCLUDE_DIR QtGui + ${QT_INCLUDE_DIR}/QtGui + ${QT_LIBRARY_DIR}/QtGui.framework/Headers + ) + # Set QT_QTMOTIF_INCLUDE_DIR + FIND_PATH( QT_QTMOTIF_INCLUDE_DIR QtMotif ${QT_INCLUDE_DIR}/QtMotif) -# QT4_WRAP_UI(outfiles inputfile ... ) + # Set QT_QTNETWORK_INCLUDE_DIR + FIND_PATH( QT_QTNETWORK_INCLUDE_DIR QtNetwork + ${QT_INCLUDE_DIR}/QtNetwork + ${QT_LIBRARY_DIR}/QtNetwork.framework/Headers + ) -MACRO(QT4_WRAP_UI outfiles ) + # Set QT_QTNSPLUGIN_INCLUDE_DIR + FIND_PATH( QT_QTNSPLUGIN_INCLUDE_DIR QtNsPlugin + ${QT_INCLUDE_DIR}/QtNsPlugin + ${QT_LIBRARY_DIR}/QtNsPlugin.framework/Headers + ) - FOREACH(it ${ARGN}) - GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) - SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it}) - SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND ${QT_UIC_EXECUTABLE} - ARGS -o ${outfile} ${infile} - MAIN_DEPENDENCY ${infile}) - SET(${outfiles} ${${outfiles}} ${outfile}) - ENDFOREACH(it) + # Set QT_QTOPENGL_INCLUDE_DIR + FIND_PATH( QT_QTOPENGL_INCLUDE_DIR QtOpenGL + ${QT_INCLUDE_DIR}/QtOpenGL + ${QT_LIBRARY_DIR}/QtOpenGL.framework/Headers + ) -ENDMACRO(QT4_WRAP_UI) + # Set QT_QTSQL_INCLUDE_DIR + FIND_PATH( QT_QTSQL_INCLUDE_DIR QtSql + ${QT_INCLUDE_DIR}/QtSql + ${QT_LIBRARY_DIR}/QtSql.framework/Headers + ) -# QT4_ADD_RESOURCE(outfiles inputfile ... ) -# TODO perhaps consider adding support for compression and root options to rcc + # Set QT_QTXML_INCLUDE_DIR + FIND_PATH( QT_QTXML_INCLUDE_DIR QtXml + ${QT_INCLUDE_DIR}/QtXml + ${QT_LIBRARY_DIR}/QtXml.framework/Headers + ) -MACRO(QT4_ADD_RESOURCES outfiles ) + # Set QT_QTASSISTANT_INCLUDE_DIR + FIND_PATH( QT_QTASSISTANT_INCLUDE_DIR QtAssistant + ${QT_INCLUDE_DIR}/QtAssistant + ${QT_HEADERS_DIR}/QtAssistant + ) - FOREACH(it ${ARGN}) - GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE) - SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it}) - SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND ${QT_RCC_EXECUTABLE} - ARGS -name ${outfilename} -o ${outfile} ${infile} - MAIN_DEPENDENCY ${infile} ) - SET(${outfiles} ${${outfiles}} ${outfile}) - ENDFOREACH(it) + # Set QT_QTDESIGNER_INCLUDE_DIR + FIND_PATH( QT_QTDESIGNER_INCLUDE_DIR QDesignerComponents + ${QT_INCLUDE_DIR}/QtDesigner + ${QT_HEADERS_DIR}/QtDesigner + ) -ENDMACRO(QT4_ADD_RESOURCES) + # Make variables changeble to the advanced user + MARK_AS_ADVANCED( + QT_LIBRARY_DIR + 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_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 (QT_USE_FRAMEWORKS) + # If FIND_LIBRARY found libraries in Apple frameworks, we would not have + # to jump through these hoops. + SET(QT_QTCORE_LIBRARY "-F${QT_LIBRARY_DIR} -framework QtCore" + CACHE STRING "The QtCore library.") + SET(QT_QTCORE_LIBRARY_DEBUG "-F${QT_LIBRARY_DIR} -framework QtCore" + CACHE STRING "The QtCore library.") + SET(QT_QT3SUPPORT_LIBRARY "-framework Qt3Support" + CACHE STRING "The Qt3Support library.") + SET(QT_QT3SUPPORT_LIBRARY_DEBUG "-framework Qt3Support" + CACHE STRING "The Qt3Support library.") + SET(QT_QTGUI_LIBRARY "-framework QtGui" + CACHE STRING "The QtGui library.") + SET(QT_QTGUI_LIBRARY_DEBUG "-framework QtGui" + CACHE STRING "The QtGui library.") + SET(QT_QTNETWORK_LIBRARY "-framework QtNetwork" + CACHE STRING "The QtNetwork library.") + SET(QT_QTNETWORK_LIBRARY_DEBUG "-framework QtNetwork" + CACHE STRING "The QtNetwork library.") + SET(QT_QTOPENGL_LIBRARY "-framework QtOpenGL" + CACHE STRING "The QtOpenGL library.") + SET(QT_QTOPENGL_LIBRARY_GUI "-framework QtOpenGL" + CACHE STRING "The QtOpenGL library.") + SET(QT_QTSQL_LIBRARY "-framework QtSql" + CACHE STRING "The QtSql library.") + SET(QT_QTSQL_LIBRARY_DEBUG "-framework QtSql" + CACHE STRING "The QtSql library.") + SET(QT_QTXML_LIBRARY "-framework QtXml" + CACHE STRING "The QtXml library.") + SET(QT_QTXML_LIBRARY_DEBUG "-framework QtXml" + CACHE STRING "The QtXml library.") + ELSE (QT_USE_FRAMEWORKS) + + # Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of + # the filename + FIND_LIBRARY( QT_QTCORE_LIBRARY + NAMES QtCore QtCore4 + PATHS + ${QT_LIBRARY_DIR} + $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 ) + + # Set QT_QTCORE_LIBRARY_DEBUG by searching for a lib with "QtCore_debug" + # as part of the filename + FIND_LIBRARY( QT_QTCORE_LIBRARY_DEBUG + NAMES QtCore_debug QtCored4 + PATHS + ${QT_LIBRARY_DIR} + $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 ) + + # Set QT_QT3SUPPORT_LIBRARY + FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG NAMES Qt3Support_debug Qt3Supportd4 PATHS ${QT_LIBRARY_DIR}) + + # Set QT_QTGUI_LIBRARY + FIND_LIBRARY(QT_QTGUI_LIBRARY NAMES QtGui QtGui4 PATHS ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG NAMES QtGui_debug QtGuid4 PATHS ${QT_LIBRARY_DIR}) + + # Set QT_QTMOTIF_LIBRARY + FIND_LIBRARY(QT_QTMOTIF_LIBRARY NAMES QtMotif PATHS ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTMOTIF_LIBRARY_DEBUG NAMES QtMotif_debug PATHS ${QT_LIBRARY_DIR}) + + # Set QT_QTNETWORK_LIBRARY + FIND_LIBRARY(QT_QTNETWORK_LIBRARY NAMES QtNetwork QtNetwork4 PATHS ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG NAMES QtNetwork_debug QtNetworkd4 PATHS ${QT_LIBRARY_DIR}) + + # Set QT_QTNSPLUGIN_LIBRARY + FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY NAMES QtNsPlugin PATHS ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_DEBUG NAMES QtNsPlugin_debug PATHS ${QT_LIBRARY_DIR}) + + # Set QT_QTOPENGL_LIBRARY + FIND_LIBRARY(QT_QTOPENGL_LIBRARY NAMES QtOpenGL QtOpenGL4 PATHS ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG NAMES QtOpenGL_debug QtOpenGLd4 PATHS ${QT_LIBRARY_DIR}) + + # Set QT_QTSQL_LIBRARY + FIND_LIBRARY(QT_QTSQL_LIBRARY NAMES QtSql QtSql4 PATHS ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG NAMES QtSql_debug QtSqld4 PATHS ${QT_LIBRARY_DIR}) + + # Set QT_QTXML_LIBRARY + FIND_LIBRARY(QT_QTXML_LIBRARY NAMES QtXml QtXml4 PATHS ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG NAMES QtXml_debug QtXmld4 PATHS ${QT_LIBRARY_DIR}) -###################################### -# -# 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( QT4_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( QT4_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) -SET(QT_FOUND ${QT4_FOUND}) - - -####################################### -# -# System dependent settings -# -####################################### -# for unix add X11 stuff -IF(UNIX) - FIND_PACKAGE(X11) -ENDIF(UNIX) + ENDIF (QT_USE_FRAMEWORKS) + # Set QT_QTASSISTANT_LIBRARY + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY NAMES QtAssistant QtAssistant4 PATHS ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistant_debug QtAssistantd4 PATHS ${QT_LIBRARY_DIR}) + + # Set QT_QTDESIGNER_LIBRARY + FIND_LIBRARY(QT_QTDESIGNER_LIBRARY NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG NAMES QtDesigner_debug QtDesignerd4 PATHS ${QT_LIBRARY_DIR}) + + # 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 ) + + # 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 ) + + ############################################ + # + # Check the existence of the libraries. + # + ############################################ + + IF (QT_QTCORE_INCLUDE_DIR AND QT_QTCORE_LIBRARY) + SET(QT_QTCORE_FOUND 1) + IF (NOT QT_QTCORE_LIBRARY_DEBUG) + SET(QT_QTCORE_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY}) + ENDIF (NOT QT_QTCORE_LIBRARY_DEBUG) + ENDIF (QT_QTCORE_INCLUDE_DIR AND QT_QTCORE_LIBRARY) + + IF (QT_QTGUI_INCLUDE_DIR AND QT_QTGUI_LIBRARY) + SET(QT_QTGUI_FOUND 1) + IF (NOT QT_QTGUI_LIBRARY_DEBUG) + SET(QT_QTGUI_LIBRARY_DEBUG ${QT_QTGUI_LIBRARY}) + ENDIF (NOT QT_QTGUI_LIBRARY_DEBUG) + ENDIF (QT_QTGUI_INCLUDE_DIR AND QT_QTGUI_LIBRARY) + + IF (QT_QT3SUPPORT_INCLUDE_DIR AND QT_QT3SUPPORT_LIBRARY) + SET(QT_QT3SUPPORT_FOUND 1) + IF (NOT QT_QT3SUPPORT_LIBRARY_DEBUG) + SET(QT_QT3SUPPORT_LIBRARY_DEBUG ${QT_QT3SUPPORT_LIBRARY}) + ENDIF (NOT QT_QT3SUPPORT_LIBRARY_DEBUG) + ENDIF (QT_QT3SUPPORT_INCLUDE_DIR AND QT_QT3SUPPORT_LIBRARY) + + IF (QT_QTASSISTANT_INCLUDE_DIR AND QT_QTASSISTANT_LIBRARY) + SET(QT_QTASSISTANT_FOUND 1) + IF (NOT QT_QTASSISTANT_LIBRARY_DEBUG) + SET(QT_QTASSISTANT_LIBRARY_DEBUG ${QT_QTASSISTANT_LIBRARY}) + ENDIF (NOT QT_QTASSISTANT_LIBRARY_DEBUG) + ENDIF (QT_QTASSISTANT_INCLUDE_DIR AND QT_QTASSISTANT_LIBRARY) + + IF (QT_QTDESIGNER_INCLUDE_DIR AND QT_QTDESIGNER_LIBRARY) + SET(QT_QTDESIGNER_FOUND 1) + IF (NOT QT_QTDESIGNER_LIBRARY_DEBUG) + SET(QT_QTDESIGNER_LIBRARY_DEBUG ${QT_QTDESIGNER_LIBRARY}) + ENDIF (NOT QT_QTDESIGNER_LIBRARY_DEBUG) + ENDIF (QT_QTDESIGNER_INCLUDE_DIR AND QT_QTDESIGNER_LIBRARY) + + IF (QT_QTMOTIF_INCLUDE_DIR AND QT_QTMOTIF_LIBRARY) + SET(QT_QTMOTIF_FOUND 1) + IF (NOT QT_QTMOTIF_LIBRARY_DEBUG) + SET(QT_QTMOTIF_LIBRARY_DEBUG ${QT_QTMOTIF_LIBRARY}) + ENDIF (NOT QT_QTMOTIF_LIBRARY_DEBUG) + ENDIF (QT_QTMOTIF_INCLUDE_DIR AND QT_QTMOTIF_LIBRARY) + + IF (QT_QTNETWORK_INCLUDE_DIR AND QT_QTNETWORK_LIBRARY) + SET(QT_QTNETWORK_FOUND 1) + IF (NOT QT_QTNETWORK_LIBRARY_DEBUG) + SET(QT_QTNETWORK_LIBRARY_DEBUG ${QT_QTNETWORK_LIBRARY}) + ENDIF (NOT QT_QTNETWORK_LIBRARY_DEBUG) + ENDIF (QT_QTNETWORK_INCLUDE_DIR AND QT_QTNETWORK_LIBRARY) + + IF (QT_QTNSPLUGIN_INCLUDE_DIR AND QT_QTNSPLUGIN_LIBRARY) + SET(QT_QTNSPLUGIN_FOUND 1) + IF (NOT QT_QTNSPLUGIN_LIBRARY_DEBUG) + SET(QT_QTNSPLUGIN_LIBRARY_DEBUG ${QT_QTNSPLUGIN_LIBRARY}) + ENDIF (NOT QT_QTNSPLUGIN_LIBRARY_DEBUG) + ENDIF (QT_QTNSPLUGIN_INCLUDE_DIR AND QT_QTNSPLUGIN_LIBRARY) + + IF (QT_QTOPENGL_INCLUDE_DIR AND QT_QTOPENGL_LIBRARY) + SET(QT_QTOPENGL_FOUND 1) + IF (NOT QT_QTOPENGL_LIBRARY_DEBUG) + SET(QT_QTOPENGL_LIBRARY_DEBUG ${QT_QTOPENGL_LIBRARY}) + ENDIF (NOT QT_QTOPENGL_LIBRARY_DEBUG) + ENDIF (QT_QTOPENGL_INCLUDE_DIR AND QT_QTOPENGL_LIBRARY) + + IF (QT_QTSQL_INCLUDE_DIR AND QT_QTSQL_LIBRARY) + SET(QT_QTSQL_FOUND 1) + IF (NOT QT_QTSQL_LIBRARY_DEBUG) + SET(QT_QTSQL_LIBRARY_DEBUG ${QT_QTSQL_LIBRARY}) + ENDIF (NOT QT_QTSQL_LIBRARY_DEBUG) + ENDIF (QT_QTSQL_INCLUDE_DIR AND QT_QTSQL_LIBRARY) + + IF (QT_QTXML_INCLUDE_DIR AND QT_QTXML_LIBRARY) + SET(QT_QTXML_FOUND 1) + IF (NOT QT_QTXML_LIBRARY_DEBUG) + SET(QT_QTXML_LIBRARY_DEBUG ${QT_QTXML_LIBRARY}) + ENDIF (NOT QT_QTXML_LIBRARY_DEBUG) + ENDIF (QT_QTXML_INCLUDE_DIR AND QT_QTXML_LIBRARY) + + ####################################### + # + # Check the executables of Qt + # ( moc, uic, rcc ) + # + ####################################### + IF (NOT QT_BINARY_DIR) + EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} + ARGS "-query QT_INSTALL_BINS" + OUTPUT_VARIABLE qt_bins ) + SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "") + ENDIF (NOT QT_BINARY_DIR) + FIND_PROGRAM(QT_MOC_EXECUTABLE + NAMES moc + PATHS + ${QT_BINARY_DIR} + $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 + ) -####################################### -# -# compatibility settings -# -####################################### -# Backwards compatibility for CMake1.4 and 1.2 -SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) -SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) + IF(QT_MOC_EXECUTABLE) + SET ( QT_WRAP_CPP "YES") + ENDIF(QT_MOC_EXECUTABLE) + + FIND_PROGRAM(QT_UIC_EXECUTABLE + NAMES uic + PATHS + ${QT_BINARY_DIR} + $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 + ) -SET( QT_QT_LIBRARY "") -SET( QT_QTMAIN_LIBRARY "") + IF(QT_UIC_EXECUTABLE) + SET ( QT_WRAP_UI "YES") + ENDIF(QT_UIC_EXECUTABLE) + + FIND_PROGRAM(QT_RCC_EXECUTABLE + NAMES rcc + PATHS + ${QT_BINARY_DIR} + $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 + ) + MARK_AS_ADVANCED( + QT_UIC_EXECUTABLE + QT_MOC_EXECUTABLE + QT_RCC_EXECUTABLE ) + + ###################################### + # + # Macros for building Qt files + # + ###################################### + + + # QT4_WRAP_CPP(outfiles inputfile ... ) + # TODO perhaps add support for -D, -U and other minor options + + MACRO(QT4_WRAP_CPP outfiles ) + + # get include dirs + GET_DIRECTORY_PROPERTY(moc_includes_tmp INCLUDE_DIRECTORIES) + SET(moc_includes) + FOREACH(it ${moc_includes_tmp}) + SET(moc_includes ${moc_includes} "-I${it}") + ENDFOREACH(it) + + FOREACH(it ${ARGN}) + GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) + + SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it}) + SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/moc_${outfile}.cxx) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${moc_includes} -o ${outfile} ${infile} + MAIN_DEPENDENCY ${infile}) + SET(${outfiles} ${${outfiles}} ${outfile}) + ENDFOREACH(it) + + ENDMACRO(QT4_WRAP_CPP) + + + # QT4_WRAP_UI(outfiles inputfile ... ) + + MACRO(QT4_WRAP_UI outfiles ) + + FOREACH(it ${ARGN}) + GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) + SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it}) + SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_UIC_EXECUTABLE} + ARGS -o ${outfile} ${infile} + MAIN_DEPENDENCY ${infile}) + SET(${outfiles} ${${outfiles}} ${outfile}) + ENDFOREACH(it) + + ENDMACRO(QT4_WRAP_UI) + + # QT4_ADD_RESOURCE(outfiles inputfile ... ) + # TODO perhaps consider adding support for compression and root options to rcc + + MACRO(QT4_ADD_RESOURCES outfiles ) + + FOREACH(it ${ARGN}) + GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE) + SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it}) + SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_RCC_EXECUTABLE} + ARGS -name ${outfilename} -o ${outfile} ${infile} + MAIN_DEPENDENCY ${infile} ) + SET(${outfiles} ${${outfiles}} ${outfile}) + ENDFOREACH(it) + + ENDMACRO(QT4_ADD_RESOURCES) + + + + ###################################### + # + # 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( QT4_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( QT4_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) + SET(QT_FOUND ${QT4_FOUND}) + + + ####################################### + # + # System dependent settings + # + ####################################### + # for unix add X11 stuff + IF(UNIX) + FIND_PACKAGE(X11) + 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_QT_LIBRARY "") + SET( QT_QTMAIN_LIBRARY "") +ELSE(QT4_QMAKE_FOUND) + MESSAGE("QT_QMAKE_EXECUTABLE set to qmake version: ${QTVERSION} ${QT_QMAKE_EXECUTABLE}, please set to path to qmake from qt4.") +ENDIF(QT4_QMAKE_FOUND) |