diff options
Diffstat (limited to 'Modules/FindQt.cmake')
-rw-r--r-- | Modules/FindQt.cmake | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 2b8dfd7fb..13f18fe7a 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -1,16 +1,16 @@ -# - Searches for all installed versions of QT. +# - Searches for all installed versions of Qt. # This should only be used if your project can work with multiple -# versions of QT. If not, you should just directly use FindQt4 or FindQt3. -# If multiple versions of QT are found on the machine, then +# versions of Qt. If not, you should just directly use FindQt4 or FindQt3. +# If multiple versions of Qt are found on the machine, then # The user must set the option DESIRED_QT_VERSION to the version # they want to use. If only one version of qt is found on the machine, -# then the DESIRED_QT_VERSION is set to that version and the +# then the DESIRED_QT_VERSION is set to that version and the # matching FindQt3 or FindQt4 module is included. # Once the user sets DESIRED_QT_VERSION, then the FindQt3 or FindQt4 module # is included. # -# QT_REQUIRED if this is set to TRUE then if CMake can -# not find QT4 or QT3 an error is raised +# QT_REQUIRED if this is set to TRUE then if CMake can +# not find Qt4 or Qt3 an error is raised # and a message is sent to the user. # # DESIRED_QT_VERSION OPTION is created @@ -31,52 +31,52 @@ # License text for the above reference.) # look for signs of qt3 installations -FILE(GLOB GLOB_TEMP_VAR /usr/lib/qt-3*/bin/qmake) -IF(GLOB_TEMP_VAR) - SET(QT3_INSTALLED TRUE) -ENDIF(GLOB_TEMP_VAR) -SET(GLOB_TEMP_VAR) +file(GLOB GLOB_TEMP_VAR /usr/lib/qt-3*/bin/qmake) +if(GLOB_TEMP_VAR) + set(QT3_INSTALLED TRUE) +endif() +set(GLOB_TEMP_VAR) -FILE(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-3*/bin/qmake) -IF(GLOB_TEMP_VAR) - SET(QT3_INSTALLED TRUE) -ENDIF(GLOB_TEMP_VAR) -SET(GLOB_TEMP_VAR) +file(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-3*/bin/qmake) +if(GLOB_TEMP_VAR) + set(QT3_INSTALLED TRUE) +endif() +set(GLOB_TEMP_VAR) # look for qt4 installations -FILE(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-4*/bin/qmake) -IF(GLOB_TEMP_VAR) - SET(QT4_INSTALLED TRUE) -ENDIF(GLOB_TEMP_VAR) -SET(GLOB_TEMP_VAR) +file(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-4*/bin/qmake) +if(GLOB_TEMP_VAR) + set(QT4_INSTALLED TRUE) +endif() +set(GLOB_TEMP_VAR) -FILE(GLOB GLOB_TEMP_VAR /usr/local/Trolltech/Qt-4*/bin/qmake) -IF(GLOB_TEMP_VAR) - SET(QT4_INSTALLED TRUE) -ENDIF(GLOB_TEMP_VAR) -SET(GLOB_TEMP_VAR) +file(GLOB GLOB_TEMP_VAR /usr/local/Trolltech/Qt-4*/bin/qmake) +if(GLOB_TEMP_VAR) + set(QT4_INSTALLED TRUE) +endif() +set(GLOB_TEMP_VAR) # now find qmake -FIND_PROGRAM(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin") -IF(QT_QMAKE_EXECUTABLE_FINDQT) - EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION" +find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin") +if(QT_QMAKE_EXECUTABLE_FINDQT) + exec_program(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) - IF(QTVERSION MATCHES "4.*") - SET(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "QT4 qmake program.") - SET(QT4_INSTALLED TRUE) - ENDIF(QTVERSION MATCHES "4.*") - IF(QTVERSION MATCHES "Unknown") - SET(QT3_INSTALLED TRUE) - ENDIF(QTVERSION MATCHES "Unknown") -ENDIF(QT_QMAKE_EXECUTABLE_FINDQT) + if(QTVERSION MATCHES "4.*") + set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "Qt4 qmake program.") + set(QT4_INSTALLED TRUE) + endif() + if(QTVERSION MATCHES "Unknown") + set(QT3_INSTALLED TRUE) + endif() +endif() -IF(QT_QMAKE_EXECUTABLE_FINDQT) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE_FINDQT} - ARGS "-query QT_INSTALL_HEADERS" +if(QT_QMAKE_EXECUTABLE_FINDQT) + exec_program( ${QT_QMAKE_EXECUTABLE_FINDQT} + ARGS "-query QT_INSTALL_HEADERS" OUTPUT_VARIABLE qt_headers ) -ENDIF(QT_QMAKE_EXECUTABLE_FINDQT) +endif() -FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h +find_file( QT4_QGLOBAL_H_FILE qglobal.h "${QT_SEARCH_PATH}/Qt/include" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/include/Qt" @@ -89,12 +89,12 @@ FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h /usr/share/qt4/include/Qt C:/Progra~1/qt/include/Qt ) -IF(QT4_QGLOBAL_H_FILE) - SET(QT4_INSTALLED TRUE) -ENDIF(QT4_QGLOBAL_H_FILE) +if(QT4_QGLOBAL_H_FILE) + set(QT4_INSTALLED TRUE) +endif() -FIND_FILE( QT3_QGLOBAL_H_FILE qglobal.h - "${QT_SEARCH_PATH}/Qt/include" +find_file( QT3_QGLOBAL_H_FILE qglobal.h + "${QT_SEARCH_PATH}/Qt/include" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" @@ -109,52 +109,52 @@ FIND_FILE( QT3_QGLOBAL_H_FILE qglobal.h C:/Progra~1/qt/include /usr/include/qt3 ) -IF(QT3_QGLOBAL_H_FILE) - SET(QT3_INSTALLED TRUE) -ENDIF(QT3_QGLOBAL_H_FILE) +if(QT3_QGLOBAL_H_FILE) + set(QT3_INSTALLED TRUE) +endif() -IF(QT3_INSTALLED AND QT4_INSTALLED ) +if(QT3_INSTALLED AND QT4_INSTALLED ) # force user to pick if we have both - SET(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of QT to use: 3 or 4") -ELSE(QT3_INSTALLED AND QT4_INSTALLED ) + set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of Qt to use: 3 or 4") +else() # if only one found then pick that one - IF(QT3_INSTALLED) - SET(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of QT to use: 3 or 4") - ENDIF(QT3_INSTALLED) - IF(QT4_INSTALLED) - SET(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of QT to use: 3 or 4") - ENDIF(QT4_INSTALLED) -ENDIF(QT3_INSTALLED AND QT4_INSTALLED ) + if(QT3_INSTALLED) + set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of Qt to use: 3 or 4") + endif() + if(QT4_INSTALLED) + set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of Qt to use: 3 or 4") + endif() +endif() -IF(DESIRED_QT_VERSION MATCHES 3) - SET(Qt3_FIND_REQUIRED ${Qt_FIND_REQUIRED}) - SET(Qt3_FIND_QUIETLY ${Qt_FIND_QUIETLY}) - INCLUDE(FindQt3) -ENDIF(DESIRED_QT_VERSION MATCHES 3) -IF(DESIRED_QT_VERSION MATCHES 4) - SET(Qt4_FIND_REQUIRED ${Qt_FIND_REQUIRED}) - SET(Qt4_FIND_QUIETLY ${Qt_FIND_QUIETLY}) - INCLUDE(FindQt4) -ENDIF(DESIRED_QT_VERSION MATCHES 4) +if(DESIRED_QT_VERSION MATCHES 3) + set(Qt3_FIND_REQUIRED ${Qt_FIND_REQUIRED}) + set(Qt3_FIND_QUIETLY ${Qt_FIND_QUIETLY}) + include(FindQt3) +endif() +if(DESIRED_QT_VERSION MATCHES 4) + set(Qt4_FIND_REQUIRED ${Qt_FIND_REQUIRED}) + set(Qt4_FIND_QUIETLY ${Qt_FIND_QUIETLY}) + include(FindQt4) +endif() -IF(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) - IF(QT_REQUIRED) - MESSAGE(SEND_ERROR "CMake was unable to find any QT versions, put qmake in your path, or set QT_QMAKE_EXECUTABLE.") - ENDIF(QT_REQUIRED) -ELSE(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) - IF(NOT QT_FOUND AND NOT DESIRED_QT_VERSION) - IF(QT_REQUIRED) - MESSAGE(SEND_ERROR "Multiple versions of QT found please set DESIRED_QT_VERSION") - ELSE(QT_REQUIRED) - MESSAGE("Multiple versions of QT found please set DESIRED_QT_VERSION") - ENDIF(QT_REQUIRED) - ENDIF(NOT QT_FOUND AND NOT DESIRED_QT_VERSION) - IF(NOT QT_FOUND AND DESIRED_QT_VERSION) - IF(QT_REQUIRED) - MESSAGE(FATAL_ERROR "CMake was unable to find QT version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.") - ELSE(QT_REQUIRED) - MESSAGE( "CMake was unable to find desired QT version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.") - 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_FINDQT) +if(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) + if(QT_REQUIRED) + message(SEND_ERROR "CMake was unable to find any Qt versions, put qmake in your path, or set QT_QMAKE_EXECUTABLE.") + endif() +else() + if(NOT QT_FOUND AND NOT DESIRED_QT_VERSION) + if(QT_REQUIRED) + message(SEND_ERROR "Multiple versions of Qt found please set DESIRED_QT_VERSION") + else() + message("Multiple versions of Qt found please set DESIRED_QT_VERSION") + endif() + endif() + if(NOT QT_FOUND AND DESIRED_QT_VERSION) + if(QT_REQUIRED) + message(FATAL_ERROR "CMake was unable to find Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.") + else() + message( "CMake was unable to find desired Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.") + endif() + endif() +endif() +mark_as_advanced(QT3_QGLOBAL_H_FILE QT4_QGLOBAL_H_FILE QT_QMAKE_EXECUTABLE_FINDQT) |