2005-09-10 01:04:28 +04:00
# 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.
2005-09-09 19:32:52 +04:00
#
2005-09-10 01:04:28 +04:00
# 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
# matching FindQt3 or FindQt4 module is included.
# Once the user sets DESIRED_QT_VERSION, then the FindQt3 or FindQt4 module
# is included.
#
2005-09-13 06:46:13 +04:00
# 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.
2005-09-10 01:04:28 +04:00
# DESIRED_QT_VERSION OPTION is created
# QT4_INSTALLED is set to TRUE if qt4 is found.
# QT3_INSTALLED is set to TRUE if qt3 is found.
2005-07-15 20:14:47 +04:00
2005-09-10 01:04:28 +04:00
# 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/local/qt-x11-commercial-3*/bin/qmake )
IF ( GLOB_TEMP_VAR )
SET ( QT3_INSTALLED TRUE )
ENDIF ( GLOB_TEMP_VAR )
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/Trolltech/Qt-4*/bin/qmake )
IF ( GLOB_TEMP_VAR )
SET ( QT4_INSTALLED TRUE )
ENDIF ( GLOB_TEMP_VAR )
SET ( GLOB_TEMP_VAR )
# now find qmake
2005-09-12 17:00:55 +04:00
FIND_PROGRAM ( QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin" )
2005-09-13 06:39:12 +04:00
IF ( QT_QMAKE_EXECUTABLE_FINDQT )
EXEC_PROGRAM ( ${ QT_QMAKE_EXECUTABLE_FINDQT } ARGS "-query QT_VERSION"
2005-09-10 01:04:28 +04:00
O U T P U T _ V A R I A B L E Q T V E R S I O N )
IF ( QTVERSION MATCHES "4.*" )
2005-09-14 17:12:50 +04:00
SET ( QT_QMAKE_EXECUTABLE ${ QT_QMAKE_EXECUTABLE_FINDQT } CACHE PATH "QT4 qmake program." )
2005-09-10 01:04:28 +04:00
SET ( QT4_INSTALLED TRUE )
ENDIF ( QTVERSION MATCHES "4.*" )
IF ( QTVERSION MATCHES "Unknown" )
SET ( QT3_INSTALLED TRUE )
ENDIF ( QTVERSION MATCHES "Unknown" )
2005-09-13 06:39:12 +04:00
ENDIF ( QT_QMAKE_EXECUTABLE_FINDQT )
2005-09-10 01:04:28 +04:00
2005-09-13 06:39:12 +04:00
IF ( QT_QMAKE_EXECUTABLE_FINDQT )
EXEC_PROGRAM ( ${ QT_QMAKE_EXECUTABLE_FINDQT }
2005-09-10 01:04:28 +04:00
A R G S " - q u e r y Q T _ I N S T A L L _ H E A D E R S "
O U T P U T _ V A R I A B L E q t _ h e a d e r s )
2005-09-13 16:52:19 +04:00
ENDIF ( QT_QMAKE_EXECUTABLE_FINDQT )
2005-09-10 01:04:28 +04:00
FIND_FILE ( QT4_QGLOBAL_H_FILE qglobal.h
2005-09-10 05:51:23 +04:00
" $ { Q T _ S E A R C H _ P A T H } / Q t / i n c l u d e "
" [ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ T r o l l t e c h \ \ Q t 3 V e r s i o n s \ \ 4 . 0 . 0 ; I n s t a l l D i r ] / i n c l u d e / Q t "
2005-09-12 19:43:24 +04:00
" [ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ T r o l l t e c h \ \ V e r s i o n s \ \ 4 . 0 . 0 ; I n s t a l l D i r ] / i n c l u d e / Q t "
2005-09-10 01:04:28 +04:00
$ { q t _ h e a d e r s } / Q t
$ E N V { Q T D I R } / i n c l u d e / Q t
/ u s r / l o c a l / q t / i n c l u d e / Q t
/ u s r / l o c a l / i n c l u d e / Q t
/ u s r / l i b / q t / i n c l u d e / Q t
/ u s r / i n c l u d e / Q t
/ u s r / s h a r e / q t 4 / i n c l u d e / Q t
2005-09-10 05:51:23 +04:00
C : / P r o g r a ~ 1 / q t / i n c l u d e / Q t )
2005-09-10 01:04:28 +04:00
IF ( QT4_QGLOBAL_H_FILE )
SET ( QT4_INSTALLED TRUE )
ENDIF ( QT4_QGLOBAL_H_FILE )
FIND_FILE ( QT3_QGLOBAL_H_FILE qglobal.h
2005-09-10 05:51:23 +04:00
" $ { Q T _ S E A R C H _ P A T H } / Q t / i n c l u d e "
" [ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ T r o l l t e c h \ \ Q t 3 V e r s i o n s \ \ 3 . 2 . 1 ; I n s t a l l D i r ] / i n c l u d e / Q t "
" [ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ T r o l l t e c h \ \ Q t 3 V e r s i o n s \ \ 3 . 2 . 0 ; I n s t a l l D i r ] / i n c l u d e / Q t "
" [ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ T r o l l t e c h \ \ Q t 3 V e r s i o n s \ \ 3 . 1 . 0 ; I n s t a l l D i r ] / i n c l u d e / Q t "
2005-09-10 01:04:28 +04:00
C : / Q t / 3 . 3 . 3 E d u c a t i o n a l / i n c l u d e
$ E N V { Q T D I R } / i n c l u d e
/ u s r / i n c l u d e / q t 3 / Q t
/ u s r / l o c a l / q t / i n c l u d e
/ u s r / l o c a l / i n c l u d e
/ u s r / l i b / q t / i n c l u d e
/ u s r / i n c l u d e
/ u s r / s h a r e / q t 3 / i n c l u d e
C : / P r o g r a ~ 1 / q t / i n c l u d e
/ u s r / i n c l u d e / q t 3 )
IF ( QT3_QGLOBAL_H_FILE )
SET ( QT3_INSTALLED TRUE )
ENDIF ( QT3_QGLOBAL_H_FILE )
IF ( QT3_INSTALLED AND QT4_INSTALLED )
# force user to pick if we have both
2005-09-10 05:51:23 +04:00
SET ( DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of QT to use: 3 or 4" )
2005-09-10 01:04:28 +04:00
ELSE ( QT3_INSTALLED AND QT4_INSTALLED )
# if only one found then pick that one
IF ( QT3_INSTALLED )
2005-09-10 05:51:23 +04:00
SET ( DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of QT to use: 3 or 4" )
2005-09-10 01:04:28 +04:00
ENDIF ( QT3_INSTALLED )
IF ( QT4_INSTALLED )
2005-09-10 05:51:23 +04:00
SET ( DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of QT to use: 3 or 4" )
2005-09-10 01:04:28 +04:00
ENDIF ( QT4_INSTALLED )
ENDIF ( QT3_INSTALLED AND QT4_INSTALLED )
IF ( DESIRED_QT_VERSION MATCHES 3 )
INCLUDE ( FindQt3 )
ENDIF ( DESIRED_QT_VERSION MATCHES 3 )
IF ( DESIRED_QT_VERSION MATCHES 4 )
INCLUDE ( FindQt4 )
ENDIF ( DESIRED_QT_VERSION MATCHES 4 )
IF ( NOT QT3_INSTALLED AND NOT QT4_INSTALLED )
2005-09-10 18:33:10 +04:00
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 )
2005-09-10 01:04:28 +04:00
ELSE ( NOT QT3_INSTALLED AND NOT QT4_INSTALLED )
IF ( NOT QT_FOUND AND NOT DESIRED_QT_VERSION )
2005-09-10 18:33:10 +04:00
IF ( QT_REQUIRED )
MESSAGE ( SEND_ERROR "Multiple versions of QT found please set DESIRED_QT_VERSION" )
2005-09-12 17:36:50 +04:00
ELSE ( QT_REQUIRED )
MESSAGE ( "Multiple versions of QT found please set DESIRED_QT_VERSION" )
2005-09-10 18:33:10 +04:00
ENDIF ( QT_REQUIRED )
2005-09-10 01:04:28 +04:00
ENDIF ( NOT QT_FOUND AND NOT DESIRED_QT_VERSION )
IF ( NOT QT_FOUND AND DESIRED_QT_VERSION )
2005-09-11 06:36:58 +04:00
IF ( QT_REQUIRED )
2005-09-12 18:33:55 +04:00
MESSAGE ( SEND_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." )
2005-09-12 17:36:50 +04:00
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." )
2005-09-11 06:36:58 +04:00
ENDIF ( QT_REQUIRED )
2005-09-10 01:04:28 +04:00
ENDIF ( NOT QT_FOUND AND DESIRED_QT_VERSION )
ENDIF ( NOT QT3_INSTALLED AND NOT QT4_INSTALLED )
2005-09-12 17:00:55 +04:00
MARK_AS_ADVANCED ( QT3_QGLOBAL_H_FILE QT4_QGLOBAL_H_FILE QT_QMAKE_EXECUTABLE_FINDQT )