2005-12-14 21:51:08 +03:00
# - Find QT 4
# This module can be used to find Qt4.
2005-12-15 22:17:43 +03:00
# This module defines a number of key variables and macros. First is
# QT_USE_FILE which is the path to a CMake file that can be included to compile
# Qt 4 applications and libraries. By default, the QtCore and QtGui
# libraries are loaded. This behavior can be changed by setting one or more
# of the following variables to true:
2005-12-14 21:51:08 +03:00
# QT_DONT_USE_QTCORE
# QT_DONT_USE_QTGUI
# QT_USE_QT3SUPPORT
# QT_USE_QTASSISTANT
# QT_USE_QTDESIGNER
# QT_USE_QTMOTIF
# QT_USE_QTNETWORK
# QT_USE_QTNSPLUGIN
# QT_USE_QTOPENGL
# QT_USE_QTSQL
# QT_USE_QTXML
2005-12-15 22:17:43 +03:00
# All the libraries required are stored in a variable called QT_LIBRARIES.
# Add this variable to your TARGET_LINK_LIBRARIES.
2005-12-14 21:51:08 +03:00
#
# macro QT4_WRAP_CPP(outfiles inputfile ... )
# macro QT4_WRAP_UI(outfiles inputfile ... )
# macro QT4_ADD_RESOURCE(outfiles inputfile ... )
#
2005-12-15 22:17:43 +03:00
# QT_FOUND If false, don't try to use Qt.
# QT4_FOUND If false, don't try to use Qt 4.
2005-12-14 21:51:08 +03:00
#
# QT_QTCORE_FOUND True if QtCore was found.
# QT_QTGUI_FOUND True if QtGui was found.
# QT_QT3SUPPORT_FOUND True if Qt3Support was found.
# QT_QTASSISTANT_FOUND True if QtAssistant was found.
# QT_QTDESIGNER_FOUND True if QtDesigner was found.
# QT_QTMOTIF_FOUND True if QtMotif was found.
# QT_QTNETWORK_FOUND True if QtNetwork was found.
# QT_QTNSPLUGIN_FOUND True if QtNsPlugin was found.
# QT_QTOPENGL_FOUND True if QtOpenGL was found.
# QT_QTSQL_FOUND True if QtSql was found.
# QT_QTXML_FOUND True if QtXml was found.
#
# QT_DEFINITIONS Definitions to use when compiling code that
# uses Qt.
#
# QT_INCLUDES List of paths to all include directories of
# Qt4 QT_INCLUDE_DIR, QT_QT_INCLUDE_DIR,
# and QT_QTGUI_INCLUDE_DIR are
# always in this variable even if NOTFOUND,
# all other INCLUDE_DIRS are
# only added if they are found.
#
# QT_INCLUDE_DIR Path to "include" of Qt4
# QT_QT_INCLUDE_DIR Path to "include/Qt"
# QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support"
# QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant"
# QT_QTCORE_INCLUDE_DIR Path to "include/QtCore"
# QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner"
# QT_QTGUI_INCLUDE_DIR Path to "include/QtGui"
# QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif"
# QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork"
# QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin"
# QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL"
# QT_QTSQL_INCLUDE_DIR Path to "include/QtSql"
# QT_QTXML_INCLUDE_DIR Path to "include/QtXml"
#
# QT_LIBRARY_DIR Path to "lib" of Qt4
#
# QT_QT3SUPPORT_LIBRARY Fullpath to Qt3Support library
# QT_QTASSISTANT_LIBRARY Fullpath to QtAssistant library
# QT_QTCORE_LIBRARY Fullpath to QtCore library
# QT_QTDESIGNER_LIBRARY Fullpath to QtDesigner library
# QT_QTGUI_LIBRARY Fullpath to QtGui library
# QT_QTMOTIF_LIBRARY Fullpath to QtMotif library
# QT_QTNETWORK_LIBRARY Fullpath to QtNetwork library
# QT_QTNSPLUGIN_LIBRARY Fullpath to QtNsPlugin library
# QT_QTOPENGL_LIBRARY Fullpath to QtOpenGL library
# QT_QTSQL_LIBRARY Fullpath to QtSql library
# QT_QTXML_LIBRARY Fullpath to QtXml library
#
# QT_QT3SUPPORT_LIBRARY_DEBUG Fullpath to Qt3Support_debug library
# QT_QTASSISTANT_LIBRARY_DEBUG Fullpath to QtAssistant_debug library
#
# QT_QTCORE_LIBRARY_DEBUG Fullpath to QtCore_debug
# QT_QTDESIGNER_LIBRARY_DEBUG Fullpath to QtDesigner_debug
# QT_QTGUI_LIBRARY_DEBUG Fullpath to QtGui_debug
# QT_QTMOTIF_LIBRARY_DEBUG Fullpath to QtMotif_debug
# QT_QTNETWORK_LIBRARY_DEBUG Fullpath to QtNetwork_debug
# QT_QTNSPLUGIN_LIBRARY_DEBUG Fullpath to QtNsPlugin_debug
# QT_QTOPENGL_LIBRARY_DEBUG Fullpath to QtOpenGL_debug
# QT_QTSQL_LIBRARY_DEBUG Fullpath to QtSql_debug
# QT_QTXML_LIBRARY_DEBUG Fullpath to QtXml_debug
#
2005-07-15 20:14:47 +04:00
# also defined, but not for general use are
2005-12-14 21:51:08 +03:00
# 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
#
2005-07-15 20:14:47 +04:00
# These are around for backwards compatibility
# they will be set
2005-12-15 22:17:43 +03:00
# QT_WRAP_CPP Set true if QT_MOC_EXECUTABLE is found
# QT_WRAP_UI Set true if QT_UIC_EXECUTABLE is found
2005-12-14 21:51:08 +03:00
#
2005-07-15 20:14:47 +04:00
# These variables do _NOT_ have any effect anymore (compared to FindQt.cmake)
2005-12-14 21:51:08 +03:00
# QT_MT_REQUIRED Qt4 is now always multithreaded
#
# These variables are set to "" Because Qt structure changed
2005-12-15 22:17:43 +03:00
# (They make no sense in Qt4)
2005-12-14 21:51:08 +03:00
# QT_QT_LIBRARY Qt-Library is now splitt
# QT_QTMAIN_LIBRARY Qt-Library is now splitt
2005-07-15 20:14:47 +04:00
2005-09-08 17:58:41 +04:00
SET ( QT_USE_FILE ${ CMAKE_ROOT } /Modules/UseQt4.cmake )
SET ( QT_DEFINITIONS "" )
IF ( WIN32 )
SET ( QT_DEFINITIONS -DQT_DLL )
ENDIF ( WIN32 )
2005-08-10 16:48:03 +04:00
2005-09-12 17:32:21 +04:00
FILE ( GLOB GLOB_TEMP_VAR /usr/local/Trolltech/Qt-4*/ )
SET ( GLOB_TEMP_VAR )
IF ( GLOB_TEMP_VAR )
SET ( QT4_PATHS ${ QT4_PATHS } ${ GLOB_TEMP_VAR } )
ENDIF ( GLOB_TEMP_VAR )
SET ( GLOB_TEMP_VAR )
FILE ( GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-4*/bin/ )
IF ( GLOB_TEMP_VAR )
SET ( QT4_PATHS ${ QT4_PATHS } ${ GLOB_TEMP_VAR } )
ENDIF ( GLOB_TEMP_VAR )
2005-08-10 16:48:03 +04:00
# check for qmake
2005-09-10 05:51:23 +04:00
FIND_PROGRAM ( QT_QMAKE_EXECUTABLE NAMES qmake PATHS
" [ 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 ] / b i n "
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 ] / b i n "
2005-09-12 17:00:55 +04:00
$ E N V { Q T D I R } / b i n
2005-09-12 17:32:21 +04:00
$ { Q T 4 _ P A T H S }
2005-09-10 05:51:23 +04:00
)
2006-01-09 20:45:37 +03:00
2005-09-12 17:00:55 +04:00
IF ( QT_QMAKE_EXECUTABLE )
2005-09-12 17:55:02 +04:00
EXEC_PROGRAM ( ${ QT_QMAKE_EXECUTABLE } ARGS "-query QT_VERSION"
2005-09-12 17:00:55 +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.*" )
SET ( QT4_QMAKE_FOUND TRUE )
ENDIF ( QTVERSION MATCHES "4.*" )
ENDIF ( QT_QMAKE_EXECUTABLE )
2006-01-09 20:45:37 +03:00
2005-09-12 17:00:55 +04:00
IF ( QT4_QMAKE_FOUND )
# Set QT_LIBRARY_DIR
IF ( NOT QT_LIBRARY_DIR )
2005-08-10 16:48:03 +04:00
EXEC_PROGRAM ( ${ QT_QMAKE_EXECUTABLE }
2005-09-12 17:00:55 +04:00
A R G S " - q u e r y Q T _ I N S T A L L _ L I B S "
O U T P U T _ V A R I A B L E Q T _ L I B R A R Y _ D I R _ T M P )
2005-09-13 17:25:29 +04:00
IF ( EXISTS "${QT_LIBRARY_DIR_TMP}" )
SET ( QT_LIBRARY_DIR ${ QT_LIBRARY_DIR_TMP } CACHE PATH "Qt library dir" )
ELSE ( EXISTS "${QT_LIBRARY_DIR_TMP}" )
MESSAGE ( "Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}" )
MESSAGE ( "Warning: ${QT_LIBRARY_DIR_TMP} does not exist, Qt must not be installed correctly." )
ENDIF ( EXISTS "${QT_LIBRARY_DIR_TMP}" )
2005-09-12 17:00:55 +04:00
ENDIF ( NOT QT_LIBRARY_DIR )
2005-09-08 17:58:41 +04:00
2005-09-12 17:00:55 +04:00
IF ( APPLE )
IF ( EXISTS ${ QT_LIBRARY_DIR } /QtCore.framework )
SET ( QT_USE_FRAMEWORKS ON
C A C H E B O O L " S e t t o O N i f Q t b u i l d u s e s f r a m e w o r k s . " )
ELSE ( EXISTS ${ QT_LIBRARY_DIR } /QtCore.framework )
SET ( QT_USE_FRAMEWORKS OFF
C A C H E B O O L " S e t t o O N i f Q t b u i l d u s e s f r a m e w o r k s . " )
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 }
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 )
SET ( QT_HEADERS_DIR ${ qt_headers } CACHE INTERNAL "" )
ENDIF ( QT_QMAKE_EXECUTABLE )
ENDIF ( NOT QT_HEADERS_DIR )
2005-09-12 17:32:21 +04:00
FILE ( GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-3*/include/Qt/ )
SET ( QT_PATH_INCLUDE ${ GLOB_TEMP_VAR } )
FILE ( GLOB GLOB_TEMP_VAR /usr/local/Trolltech/Qt-4*/include/Qt/ )
SET ( QT_PATH_INCLUDE ${ GLOB_TEMP_VAR } )
2005-09-12 17:00:55 +04:00
FIND_PATH ( QT_QT_INCLUDE_DIR qglobal.h
" [ 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 17:32:21 +04:00
$ { Q T _ P A T H _ I N C L U D E }
2005-09-12 17:00:55 +04:00
$ { Q T _ H E A D E R S _ D I R } / Q t
$ { Q T _ L I B R A R Y _ D I R } / Q t C o r e . f r a m e w o r k / H e a d e r s
$ 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
" C : / P r o g r a m F i l e s / q t / i n c l u d e / Q t "
/ u s r / i n c l u d e / q t 4 / Q t )
# 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 )
2006-01-09 20:45:37 +03:00
IF ( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED )
2006-01-25 20:16:49 +03:00
MESSAGE ( FATAL_ERROR "Could not find qglobal.h" )
2006-01-09 20:45:37 +03:00
ENDIF ( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED )
2005-09-12 17:00:55 +04:00
ENDIF ( NOT QT_INCLUDE_DIR )
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
IF ( QT_USE_FRAMEWORKS )
SET ( QT_DEFINITIONS ${ QT_DEFINITIONS }
- F $ { Q T _ L I B R A R Y _ D I R }
)
ENDIF ( QT_USE_FRAMEWORKS )
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QT3SUPPORT_INCLUDE_DIR
FIND_PATH ( QT_QT3SUPPORT_INCLUDE_DIR Qt3Support
$ { Q T _ I N C L U D E _ D I R } / Q t 3 S u p p o r t
$ { Q T _ L I B R A R Y _ D I R } / Q t 3 S u p p o r t . f r a m e w o r k / H e a d e r s
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QTCORE_INCLUDE_DIR
FIND_PATH ( QT_QTCORE_INCLUDE_DIR QtCore
$ { Q T _ I N C L U D E _ D I R } / Q t C o r e
$ { Q T _ L I B R A R Y _ D I R } / Q t C o r e . f r a m e w o r k / H e a d e r s
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QTGUI_INCLUDE_DIR
FIND_PATH ( QT_QTGUI_INCLUDE_DIR QtGui
$ { Q T _ I N C L U D E _ D I R } / Q t G u i
$ { Q T _ L I B R A R Y _ D I R } / Q t G u i . f r a m e w o r k / H e a d e r s
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QTMOTIF_INCLUDE_DIR
FIND_PATH ( QT_QTMOTIF_INCLUDE_DIR QtMotif ${ QT_INCLUDE_DIR } /QtMotif )
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QTNETWORK_INCLUDE_DIR
FIND_PATH ( QT_QTNETWORK_INCLUDE_DIR QtNetwork
$ { Q T _ I N C L U D E _ D I R } / Q t N e t w o r k
$ { Q T _ L I B R A R Y _ D I R } / Q t N e t w o r k . f r a m e w o r k / H e a d e r s
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QTNSPLUGIN_INCLUDE_DIR
FIND_PATH ( QT_QTNSPLUGIN_INCLUDE_DIR QtNsPlugin
$ { Q T _ I N C L U D E _ D I R } / Q t N s P l u g i n
$ { Q T _ L I B R A R Y _ D I R } / Q t N s P l u g i n . f r a m e w o r k / H e a d e r s
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QTOPENGL_INCLUDE_DIR
FIND_PATH ( QT_QTOPENGL_INCLUDE_DIR QtOpenGL
$ { Q T _ I N C L U D E _ D I R } / Q t O p e n G L
$ { Q T _ L I B R A R Y _ D I R } / Q t O p e n G L . f r a m e w o r k / H e a d e r s
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QTSQL_INCLUDE_DIR
FIND_PATH ( QT_QTSQL_INCLUDE_DIR QtSql
$ { Q T _ I N C L U D E _ D I R } / Q t S q l
$ { Q T _ L I B R A R Y _ D I R } / Q t S q l . f r a m e w o r k / H e a d e r s
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QTXML_INCLUDE_DIR
FIND_PATH ( QT_QTXML_INCLUDE_DIR QtXml
$ { Q T _ I N C L U D E _ D I R } / Q t X m l
$ { Q T _ L I B R A R Y _ D I R } / Q t X m l . f r a m e w o r k / H e a d e r s
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QTASSISTANT_INCLUDE_DIR
FIND_PATH ( QT_QTASSISTANT_INCLUDE_DIR QtAssistant
$ { Q T _ I N C L U D E _ D I R } / Q t A s s i s t a n t
$ { Q T _ H E A D E R S _ D I R } / Q t A s s i s t a n t
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_QTDESIGNER_INCLUDE_DIR
FIND_PATH ( QT_QTDESIGNER_INCLUDE_DIR QDesignerComponents
$ { Q T _ I N C L U D E _ D I R } / Q t D e s i g n e r
$ { Q T _ H E A D E R S _ D I R } / Q t D e s i g n e r
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Make variables changeble to the advanced user
MARK_AS_ADVANCED (
Q T _ L I B R A R Y _ D I R
Q T _ I N C L U D E _ D I R
Q T _ Q T _ I N C L U D E _ D I R
Q T _ Q T 3 S U P P O R T _ I N C L U D E _ D I R
Q T _ Q T A S S I S T A N T _ I N C L U D E _ D I R
Q T _ Q T C O R E _ I N C L U D E _ D I R
Q T _ Q T D E S I G N E R _ I N C L U D E _ D I R
Q T _ Q T G U I _ I N C L U D E _ D I R
Q T _ Q T M O T I F _ I N C L U D E _ D I R
Q T _ Q T N E T W O R K _ I N C L U D E _ D I R
Q T _ Q T N S P L U G I N _ I N C L U D E _ D I R
Q T _ Q T O P E N G L _ I N C L U D E _ D I R
Q T _ Q T S Q L _ I N C L U D E _ D I R
Q T _ Q T X M L _ I N C L U D E _ D I R
)
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
# Set QT_INCLUDES
SET ( QT_INCLUDES
$ { Q T _ I N C L U D E _ D I R }
$ { Q T _ Q T C O R E _ I N C L U D E _ D I R }
2005-09-14 19:16:02 +04:00
$ { Q T _ Q T _ I N C L U D E _ D I R }
2005-09-12 17:00:55 +04:00
$ { Q T _ Q T G U I _ I N C L U D E _ D I R }
2005-09-14 19:16:02 +04:00
)
# append optional flags
MACRO ( QT4_APPEND_INCLUDES_FLAG FLAG )
IF ( ${ FLAG } )
SET ( QT_INCLUDES ${ QT_INCLUDES } "${${FLAG}}" )
ENDIF ( ${ FLAG } )
2005-09-19 20:19:59 +04:00
ENDMACRO ( QT4_APPEND_INCLUDES_FLAG )
2005-09-14 19:16:02 +04:00
QT4_APPEND_INCLUDES_FLAG ( QT_QT3SUPPORT_INCLUDE_DIR )
QT4_APPEND_INCLUDES_FLAG ( QT_QTASSISTANT_INCLUDE_DIR )
QT4_APPEND_INCLUDES_FLAG ( QT_QTDESIGNER_INCLUDE_DIR )
QT4_APPEND_INCLUDES_FLAG ( QT_QTDESIGNER_INCLUDE_DIR )
QT4_APPEND_INCLUDES_FLAG ( QT_QTMOTIF_INCLUDE_DIR )
QT4_APPEND_INCLUDES_FLAG ( QT_QTNETWORK_INCLUDE_DIR )
QT4_APPEND_INCLUDES_FLAG ( QT_QTNSPLUGIN_INCLUDE_DIR )
QT4_APPEND_INCLUDES_FLAG ( QT_QTOPENGL_INCLUDE_DIR )
QT4_APPEND_INCLUDES_FLAG ( QT_QTSQL_INCLUDE_DIR )
QT4_APPEND_INCLUDES_FLAG ( QT_QTXML_INCLUDE_DIR )
2005-09-12 17:00:55 +04:00
########################################
#
# Setting the LIBRARY-Variables
#
########################################
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
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"
C A C H E S T R I N G " T h e Q t C o r e l i b r a r y . " )
SET ( QT_QTCORE_LIBRARY_DEBUG "-F${QT_LIBRARY_DIR} -framework QtCore"
C A C H E S T R I N G " T h e Q t C o r e l i b r a r y . " )
SET ( QT_QT3SUPPORT_LIBRARY "-framework Qt3Support"
C A C H E S T R I N G " T h e Q t 3 S u p p o r t l i b r a r y . " )
SET ( QT_QT3SUPPORT_LIBRARY_DEBUG "-framework Qt3Support"
C A C H E S T R I N G " T h e Q t 3 S u p p o r t l i b r a r y . " )
SET ( QT_QTGUI_LIBRARY "-framework QtGui"
C A C H E S T R I N G " T h e Q t G u i l i b r a r y . " )
SET ( QT_QTGUI_LIBRARY_DEBUG "-framework QtGui"
C A C H E S T R I N G " T h e Q t G u i l i b r a r y . " )
SET ( QT_QTNETWORK_LIBRARY "-framework QtNetwork"
C A C H E S T R I N G " T h e Q t N e t w o r k l i b r a r y . " )
SET ( QT_QTNETWORK_LIBRARY_DEBUG "-framework QtNetwork"
C A C H E S T R I N G " T h e Q t N e t w o r k l i b r a r y . " )
SET ( QT_QTOPENGL_LIBRARY "-framework QtOpenGL"
C A C H E S T R I N G " T h e Q t O p e n G L l i b r a r y . " )
2005-09-13 06:39:12 +04:00
SET ( QT_QTOPENGL_LIBRARY_DEBUG "-framework QtOpenGL"
2005-09-12 17:00:55 +04:00
C A C H E S T R I N G " T h e Q t O p e n G L l i b r a r y . " )
SET ( QT_QTSQL_LIBRARY "-framework QtSql"
C A C H E S T R I N G " T h e Q t S q l l i b r a r y . " )
SET ( QT_QTSQL_LIBRARY_DEBUG "-framework QtSql"
C A C H E S T R I N G " T h e Q t S q l l i b r a r y . " )
SET ( QT_QTXML_LIBRARY "-framework QtXml"
C A C H E S T R I N G " T h e Q t X m l l i b r a r y . " )
SET ( QT_QTXML_LIBRARY_DEBUG "-framework QtXml"
C A C H E S T R I N G " T h e Q t X m l l i b r a r y . " )
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
N A M E S Q t C o r e Q t C o r e 4
P A T H S
$ { Q T _ L I B R A R Y _ D I R }
$ E N V { Q T D I R } / l i b
/ u s r / l o c a l / q t / l i b
/ u s r / l o c a l / l i b
/ u s r / l i b / q t / l i b
/ u s r / l i b
/ u s r / s h a r e / q t 4 / l i b
C : / P r o g r a ~ 1 / q t / l i b
/ u s r / l i b / q t 4 )
# Set QT_QTCORE_LIBRARY_DEBUG by searching for a lib with "QtCore_debug"
# as part of the filename
FIND_LIBRARY ( QT_QTCORE_LIBRARY_DEBUG
N A M E S Q t C o r e _ d e b u g Q t C o r e d 4
P A T H S
$ { Q T _ L I B R A R Y _ D I R }
$ E N V { Q T D I R } / l i b
/ u s r / l o c a l / q t / l i b
/ u s r / l o c a l / l i b
/ u s r / l i b / q t / l i b
/ u s r / l i b
/ u s r / s h a r e / q t 4 / l i b
C : / P r o g r a ~ 1 / q t / l i b
/ u s r / l i b / q t 4 )
# 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 } )
2005-08-03 00:34:23 +04:00
2005-09-12 17:00:55 +04:00
ENDIF ( QT_USE_FRAMEWORKS )
2005-07-15 20:14:47 +04:00
2005-09-12 17:00:55 +04:00
# 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 (
Q T _ Q T 3 S U P P O R T _ L I B R A R Y
Q T _ Q T A S S I S T A N T _ L I B R A R Y
Q T _ Q T C O R E _ L I B R A R Y
Q T _ Q T D E S I G N E R _ L I B R A R Y
Q T _ Q T G U I _ L I B R A R Y
Q T _ Q T M O T I F _ L I B R A R Y
Q T _ Q T N E T W O R K _ L I B R A R Y
Q T _ Q T N S P L U G I N _ L I B R A R Y
Q T _ Q T O P E N G L _ L I B R A R Y
Q T _ Q T S Q L _ L I B R A R Y
Q T _ Q T X M L _ L I B R A R Y )
# Make variables changeble to the advanced user
MARK_AS_ADVANCED (
Q T _ Q T 3 S U P P O R T _ L I B R A R Y _ D E B U G
Q T _ Q T A S S I S T A N T _ L I B R A R Y _ D E B U G
Q T _ Q T C O R E _ L I B R A R Y _ D E B U G
Q T _ Q T D E S I G N E R _ L I B R A R Y _ D E B U G
Q T _ Q T G U I _ L I B R A R Y _ D E B U G
Q T _ Q T M O T I F _ L I B R A R Y _ D E B U G
Q T _ Q T N E T W O R K _ L I B R A R Y _ D E B U G
Q T _ Q T N S P L U G I N _ L I B R A R Y _ D E B U G
Q T _ Q T O P E N G L _ L I B R A R Y _ D E B U G
Q T _ Q T S Q L _ L I B R A R Y _ D E B U G
Q T _ Q T X M L _ L I B R A R Y _ D E B U G )
############################################
#
# 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 }
A R G S " - q u e r y Q T _ I N S T A L L _ B I N S "
O U T P U T _ V A R I A B L E q t _ b i n s )
SET ( QT_BINARY_DIR ${ qt_bins } CACHE INTERNAL "" )
ENDIF ( NOT QT_BINARY_DIR )
FIND_PROGRAM ( QT_MOC_EXECUTABLE
N A M E S m o c
P A T H S
$ { Q T _ B I N A R Y _ D I R }
$ E N V { Q T D I R } / b i n
/ u s r / l o c a l / q t / b i n
/ u s r / l o c a l / b i n
/ u s r / l i b / q t / b i n
/ u s r / b i n
/ u s r / s h a r e / q t 4 / b i n
C : / P r o g r a ~ 1 / q t / b i n
/ u s r / b i n / q t 4
)
2005-07-15 20:14:47 +04:00
2005-09-12 17:00:55 +04:00
IF ( QT_MOC_EXECUTABLE )
SET ( QT_WRAP_CPP "YES" )
ENDIF ( QT_MOC_EXECUTABLE )
FIND_PROGRAM ( QT_UIC_EXECUTABLE
N A M E S u i c
P A T H S
$ { Q T _ B I N A R Y _ D I R }
$ E N V { Q T D I R } / b i n
/ u s r / l o c a l / q t / b i n
/ u s r / l o c a l / b i n
/ u s r / l i b / q t / b i n
/ u s r / b i n
/ u s r / s h a r e / q t 4 / b i n
C : / P r o g r a ~ 1 / q t / b i n
/ u s r / b i n / q t 4
)
2005-07-15 20:14:47 +04:00
2005-09-12 17:00:55 +04:00
IF ( QT_UIC_EXECUTABLE )
SET ( QT_WRAP_UI "YES" )
ENDIF ( QT_UIC_EXECUTABLE )
FIND_PROGRAM ( QT_RCC_EXECUTABLE
N A M E S r c c
P A T H S
$ { Q T _ B I N A R Y _ D I R }
$ E N V { Q T D I R } / b i n
/ u s r / l o c a l / q t / b i n
/ u s r / l o c a l / b i n
/ u s r / l i b / q t / b i n
/ u s r / b i n
/ u s r / s h a r e / q t 4 / b i n
C : / P r o g r a ~ 1 / q t / b i n
/ u s r / b i n / q t 4
)
2005-07-15 20:14:47 +04:00
2005-09-12 17:00:55 +04:00
MARK_AS_ADVANCED (
Q T _ U I C _ E X E C U T A B L E
Q T _ M O C _ E X E C U T A B L E
Q T _ R C C _ E X E C U T A B L E )
######################################
#
# 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 }
C O M M A N D $ { Q T _ M O C _ E X E C U T A B L E }
A R G S $ { m o c _ i n c l u d e s } - o $ { o u t f i l e } $ { i n f i l e }
M A I N _ D E P E N D E N C Y $ { i n f i l e } )
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 }
C O M M A N D $ { Q T _ U I C _ E X E C U T A B L E }
A R G S - o $ { o u t f i l e } $ { i n f i l e }
M A I N _ D E P E N D E N C Y $ { i n f i l e } )
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 }
C O M M A N D $ { Q T _ R C C _ E X E C U T A B L E }
A R G S - n a m e $ { o u t f i l e n a m e } - o $ { o u t f i l e } $ { i n f i l e }
M A I N _ D E P E N D E N C Y $ { i n f i l e } )
SET ( ${ outfiles } ${ ${outfiles } } ${ outfile } )
ENDFOREACH ( it )
ENDMACRO ( QT4_ADD_RESOURCES )
######################################
#
2006-01-09 20:45:37 +03:00
# decide if Qt got found
2005-09-12 17:00:55 +04:00
#
######################################
# 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" )
2006-01-09 20:45:37 +03:00
IF ( NOT Qt4_FIND_QUIETLY )
2005-09-12 17:00:55 +04:00
MESSAGE ( STATUS "Found Qt-Version ${QT_INST_MAJOR_VERSION}.${QT_INST_MINOR_VERSION}.${QT_INST_PATCH_VERSION}" )
2006-01-09 20:45:37 +03:00
ENDIF ( NOT Qt4_FIND_QUIETLY )
2005-09-12 17:00:55 +04:00
ELSE ( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE )
SET ( QT4_FOUND "NO" )
2006-01-09 20:45:37 +03:00
IF ( Qt4_FIND_REQUIRED )
2006-01-25 20:16:49 +03:00
MESSAGE ( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!" )
2006-01-09 20:45:37 +03:00
ENDIF ( Qt4_FIND_REQUIRED )
2005-09-12 17:00:55 +04:00
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 )
2005-09-13 17:25:29 +04:00
IF ( QT_QMAKE_EXECUTABLE )
MESSAGE ( "QT_QMAKE_EXECUTABLE set to qmake version: QTVERSION = ${QTVERSION}\nQT_QMAKE_EXECUTABLE = ${QT_QMAKE_EXECUTABLE}, please set to path to qmake from qt4." )
ENDIF ( QT_QMAKE_EXECUTABLE )
2006-01-09 20:45:37 +03:00
IF ( Qt4_FIND_REQUIRED )
2006-01-25 20:16:49 +03:00
MESSAGE ( FATAL_ERROR "Qt qmake not found!" )
2006-01-09 20:45:37 +03:00
ENDIF ( Qt4_FIND_REQUIRED )
2005-09-13 17:25:29 +04:00
2005-09-12 17:00:55 +04:00
ENDIF ( QT4_QMAKE_FOUND )