2013-10-15 19:17:36 +04:00
#.rst:
# FindQt4
2014-06-02 22:11:54 +04:00
# -------
2013-10-15 19:17:36 +04:00
#
2014-01-15 16:47:26 +04:00
# Finding and Using Qt4
2014-06-02 22:11:54 +04:00
# ^^^^^^^^^^^^^^^^^^^^^
2013-10-15 19:17:36 +04:00
#
# This module can be used to find Qt4. The most important issue is that
# the Qt4 qmake is available via the system path. This qmake is then
# used to detect basically everything else. This module defines a
2014-01-15 16:47:26 +04:00
# number of :prop_tgt:`IMPORTED` targets, macros and variables.
2009-02-20 00:04:57 +03:00
#
# Typical usage could be something like:
2013-10-15 19:17:36 +04:00
#
2014-01-15 16:47:26 +04:00
# .. code-block:: cmake
2013-10-15 19:17:36 +04:00
#
2014-01-15 16:47:26 +04:00
# set(CMAKE_AUTOMOC ON)
# set(CMAKE_INCLUDE_CURRENT_DIR ON)
# find_package(Qt4 4.4.3 REQUIRED QtGui QtXml)
2013-10-15 19:17:36 +04:00
# add_executable(myexe main.cpp)
2014-01-15 16:47:26 +04:00
# target_link_libraries(myexe Qt4::QtGui Qt4::QtXml)
2013-10-15 19:17:36 +04:00
#
2014-01-15 16:47:26 +04:00
# .. note::
2013-10-15 19:17:36 +04:00
#
2014-01-15 16:47:26 +04:00
# When using :prop_tgt:`IMPORTED` targets, the qtmain.lib static library is
2014-01-30 20:29:50 +04:00
# automatically linked on Windows for :variable:`WIN32 <WIN32_EXECUTABLE>`
# executables. To disable that globally, set the
2014-01-15 16:47:26 +04:00
# ``QT4_NO_LINK_QTMAIN`` variable before finding Qt4. To disable that
# for a particular executable, set the ``QT4_NO_LINK_QTMAIN`` target
# property to ``TRUE`` on the executable.
2013-10-15 19:17:36 +04:00
#
2014-01-15 16:47:26 +04:00
# Qt Build Tools
2014-06-02 22:11:54 +04:00
# ^^^^^^^^^^^^^^
2013-10-15 19:17:36 +04:00
#
2014-01-15 16:47:26 +04:00
# Qt relies on some bundled tools for code generation, such as ``moc`` for
# meta-object code generation,``uic`` for widget layout and population,
# and ``rcc`` for virtual filesystem content generation. These tools may be
# automatically invoked by :manual:`cmake(1)` if the appropriate conditions
2014-02-02 14:09:49 +04:00
# are met. See :manual:`cmake-qt(7)` for more.
2013-10-15 19:17:36 +04:00
#
2014-01-15 16:47:26 +04:00
# Qt Macros
2014-06-02 22:11:54 +04:00
# ^^^^^^^^^
2013-10-15 19:17:36 +04:00
#
2014-01-15 16:47:26 +04:00
# In some cases it can be necessary or useful to invoke the Qt build tools in a
# more-manual way. Several macros are available to add targets for such uses.
2013-10-15 19:17:36 +04:00
#
# ::
#
2014-01-14 17:55:05 +04:00
# macro QT4_WRAP_CPP(outfiles inputfile ... [TARGET tgt] OPTIONS ...)
2013-10-15 19:17:36 +04:00
# create moc code from a list of files containing Qt class with
# the Q_OBJECT declaration. Per-directory preprocessor definitions
2014-01-14 17:55:05 +04:00
# are also added. If the <tgt> is specified, the
# INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS from
# the <tgt> are passed to moc. Options may be given to moc, such as
# those found when executing "moc -help".
2013-10-15 19:17:36 +04:00
#
#
# ::
#
# macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...)
# create code from a list of Qt designer ui files.
# Options may be given to uic, such as those found
# when executing "uic -help"
#
#
# ::
#
# macro QT4_ADD_RESOURCES(outfiles inputfile ... OPTIONS ...)
# create code from a list of Qt resource files.
# Options may be given to rcc, such as those found
# when executing "rcc -help"
#
#
# ::
#
2014-01-14 17:55:05 +04:00
# macro QT4_GENERATE_MOC(inputfile outputfile [TARGET tgt])
2013-10-15 19:17:36 +04:00
# creates a rule to run moc on infile and create outfile.
# Use this if for some reason QT4_WRAP_CPP() isn't appropriate, e.g.
2014-01-14 17:55:05 +04:00
# because you need a custom filename for the moc file or something
# similar. If the <tgt> is specified, the
# INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS from
# the <tgt> are passed to moc.
2013-10-15 19:17:36 +04:00
#
#
# ::
#
# macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename)
# Create the interface header and implementation files with the
# given basename from the given interface xml file and add it to
# the list of sources.
#
# You can pass additional parameters to the qdbusxml2cpp call by setting
# properties on the input file:
#
# INCLUDE the given file will be included in the generate interface header
#
# CLASSNAME the generated class is named accordingly
#
# NO_NAMESPACE the generated class is not wrapped in a namespace
#
#
# ::
#
# macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... )
# Create the interface header and implementation files
# for all listed interface xml files.
# The basename will be automatically determined from the name of the xml file.
#
# The source file properties described for QT4_ADD_DBUS_INTERFACE also apply here.
#
#
# ::
#
# macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] [classname])
# create a dbus adaptor (header and implementation file) from the xml file
# describing the interface, and add it to the list of sources. The adaptor
# forwards the calls to a parent class, defined in parentheader and named
# parentclassname. The name of the generated files will be
# <basename>adaptor.{cpp,h} where basename defaults to the basename of the xml file.
# If <classname> is provided, then it will be used as the classname of the
# adaptor itself.
#
#
# ::
#
# macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...)
# generate the xml interface file from the given header.
# If the optional argument interfacename is omitted, the name of the
# interface file is constructed from the basename of the header with
# the suffix .xml appended.
# Options may be given to qdbuscpp2xml, such as those found when executing "qdbuscpp2xml --help"
#
#
# ::
#
# macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ...
# ts_files ... OPTIONS ...)
# out: qm_files
# in: directories sources ts_files
# options: flags to pass to lupdate, such as -extensions to specify
# extensions for a directory scan.
# generates commands to create .ts (vie lupdate) and .qm
# (via lrelease) - files from directories and/or sources. The ts files are
# created and/or updated in the source tree (unless given with full paths).
# The qm files are generated in the build tree.
# Updating the translations can be done by adding the qm_files
# to the source list of your library/executable, so they are
# always updated, or by adding a custom target to control when
# they get updated/generated.
#
#
# ::
#
# macro QT4_ADD_TRANSLATION( qm_files ts_files ... )
# out: qm_files
# in: ts_files
# generates commands to create .qm from .ts - files. The generated
# filenames can be found in qm_files. The ts_files
# must exist and are not updated in any way.
#
#
2014-01-15 16:47:26 +04:00
# ::
#
# macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... [TARGET tgt])
# The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.
# This macro is still experimental.
# It can be used to have moc automatically handled.
# So if you have the files foo.h and foo.cpp, and in foo.h a
# a class uses the Q_OBJECT macro, moc has to run on it. If you don't
# want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert
# #include "foo.moc"
# in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the
# scan all listed files at cmake-time for such included moc files and if it finds
# them cause a rule to be generated to run moc at build time on the
# accompanying header file foo.h.
# If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro.
# If the <tgt> is specified, the INTERFACE_INCLUDE_DIRECTORIES and
# INTERFACE_COMPILE_DEFINITIONS from the <tgt> are passed to moc.
2008-01-22 18:11:29 +03:00
#
2013-10-15 19:17:36 +04:00
#
# ::
#
2014-01-15 16:47:26 +04:00
# function QT4_USE_MODULES( target [link_type] modules...)
2013-10-15 19:17:36 +04:00
# This function is obsolete. Use target_link_libraries with IMPORTED targets instead.
# Make <target> use the <modules> from Qt. Using a Qt module means
# to link to the library, add the relevant include directories for the module,
# and add the relevant compiler defines for using the module.
# Modules are roughly equivalent to components of Qt4, so usage would be
# something like:
# qt4_use_modules(myexe Core Gui Declarative)
# to use QtCore, QtGui and QtDeclarative. The optional <link_type> argument can
# be specified as either LINK_PUBLIC or LINK_PRIVATE to specify the same argument
# to the target_link_libraries call.
#
#
2014-01-15 16:47:26 +04:00
# IMPORTED Targets
2014-06-02 22:11:54 +04:00
# ^^^^^^^^^^^^^^^^
2014-01-15 16:47:26 +04:00
#
# A particular Qt library may be used by using the corresponding
# :prop_tgt:`IMPORTED` target with the :command:`target_link_libraries`
# command:
#
# .. code-block:: cmake
#
# target_link_libraries(myexe Qt4::QtGui Qt4::QtXml)
#
# Using a target in this way causes :cmake(1)` to use the appropriate include
# directories and compile definitions for the target when compiling ``myexe``.
#
# Targets are aware of their dependencies, so for example it is not necessary
# to list ``Qt4::QtCore`` if another Qt library is listed, and it is not
# necessary to list ``Qt4::QtGui`` if ``Qt4::QtDeclarative`` is listed.
# Targets may be tested for existence in the usual way with the
# :command:`if(TARGET)` command.
#
# The Qt toolkit may contain both debug and release libraries.
# :manual:`cmake(1)` will choose the appropriate version based on the build
# configuration.
#
# ``Qt4::QtCore``
# The QtCore target
# ``Qt4::QtGui``
# The QtGui target
# ``Qt4::Qt3Support``
# The Qt3Support target
# ``Qt4::QtAssistant``
# The QtAssistant target
# ``Qt4::QtAssistantClient``
# The QtAssistantClient target
# ``Qt4::QAxContainer``
# The QAxContainer target (Windows only)
# ``Qt4::QAxServer``
# The QAxServer target (Windows only)
# ``Qt4::QtDBus``
# The QtDBus target
# ``Qt4::QtDesigner``
# The QtDesigner target
# ``Qt4::QtDesignerComponents``
# The QtDesignerComponents target
# ``Qt4::QtHelp``
# The QtHelp target
# ``Qt4::QtMotif``
# The QtMotif target
# ``Qt4::QtMultimedia``
# The QtMultimedia target
# ``Qt4::QtNetwork``
# The QtNetwork target
# ``Qt4::QtNsPLugin``
# The QtNsPLugin target
# ``Qt4::QtOpenGL``
# The QtOpenGL target
# ``Qt4::QtScript``
# The QtScript target
# ``Qt4::QtScriptTools``
# The QtScriptTools target
# ``Qt4::QtSql``
# The QtSql target
# ``Qt4::QtSvg``
# The QtSvg target
# ``Qt4::QtTest``
# The QtTest target
# ``Qt4::QtUiTools``
# The QtUiTools target
# ``Qt4::QtWebKit``
# The QtWebKit target
# ``Qt4::QtXml``
# The QtXml target
# ``Qt4::QtXmlPatterns``
# The QtXmlPatterns target
# ``Qt4::phonon``
# The phonon target
#
# Result Variables
2014-06-02 22:11:54 +04:00
# ^^^^^^^^^^^^^^^^
2013-10-15 19:17:36 +04:00
#
# Below is a detailed list of variables that FindQt4.cmake sets.
#
2014-01-15 16:47:26 +04:00
# ``Qt4_FOUND``
# If false, don't try to use Qt 4.
# ``QT_FOUND``
# If false, don't try to use Qt. This variable is for compatibility only.
# ``QT4_FOUND``
# If false, don't try to use Qt 4. This variable is for compatibility only.
# ``QT_VERSION_MAJOR``
# The major version of Qt found.
# ``QT_VERSION_MINOR``
# The minor version of Qt found.
# ``QT_VERSION_PATCH``
# The patch version of Qt found.
2006-04-27 23:07:23 +04:00
2009-09-28 19:45:50 +04:00
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
2010-08-07 04:48:47 +04:00
# (To distribute this file outside of CMake, substitute the full
2009-09-28 19:45:50 +04:00
# License text for the above reference.)
2009-02-20 00:04:57 +03:00
2012-08-13 21:47:32 +04:00
# Use find_package( Qt4 COMPONENTS ... ) to enable modules
if ( Qt4_FIND_COMPONENTS )
foreach ( component ${ Qt4_FIND_COMPONENTS } )
string ( TOUPPER ${ component } _COMPONENT )
set ( QT_USE_ ${ _COMPONENT } 1 )
2012-08-13 21:50:14 +04:00
endforeach ( )
2012-08-13 21:42:58 +04:00
2009-02-20 00:04:57 +03:00
# To make sure we don't use QtCore or QtGui when not in COMPONENTS
2012-08-13 21:47:32 +04:00
if ( NOT QT_USE_QTCORE )
set ( QT_DONT_USE_QTCORE 1 )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:42:58 +04:00
2012-08-13 21:47:32 +04:00
if ( NOT QT_USE_QTGUI )
set ( QT_DONT_USE_QTGUI 1 )
2012-08-13 21:50:14 +04:00
endif ( )
2009-02-20 00:04:57 +03:00
2012-08-13 21:50:14 +04:00
endif ( )
2009-02-20 00:04:57 +03:00
2008-08-17 03:11:53 +04:00
# If Qt3 has already been found, fail.
2012-08-13 21:47:32 +04:00
if ( QT_QT_LIBRARY )
if ( Qt4_FIND_REQUIRED )
message ( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned." )
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
if ( NOT Qt4_FIND_QUIETLY )
message ( STATUS "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned." )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
return ( )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
2008-08-17 03:11:53 +04:00
2012-11-04 00:35:44 +04:00
include ( ${ CMAKE_CURRENT_LIST_DIR } /CheckCXXSymbolExists.cmake )
include ( ${ CMAKE_CURRENT_LIST_DIR } /MacroAddFileDependencies.cmake )
2012-08-13 21:47:32 +04:00
include ( ${ CMAKE_CURRENT_LIST_DIR } /FindPackageHandleStandardArgs.cmake )
2014-03-30 06:22:54 +04:00
include ( ${ CMAKE_CURRENT_LIST_DIR } /CMakePushCheckState.cmake )
2005-07-15 20:14:47 +04:00
2012-08-13 21:47:32 +04:00
set ( QT_USE_FILE ${ CMAKE_ROOT } /Modules/UseQt4.cmake )
2005-09-08 17:58:41 +04:00
2012-08-13 21:47:32 +04:00
set ( QT_DEFINITIONS "" )
2005-09-08 17:58:41 +04:00
2010-07-03 01:43:38 +04:00
# convenience macro for dealing with debug/release library names
2012-08-13 21:47:32 +04:00
macro ( _QT4_ADJUST_LIB_VARS _camelCaseBasename )
2010-07-03 01:43:38 +04:00
2012-08-13 21:47:32 +04:00
string ( TOUPPER "${_camelCaseBasename}" basename )
2010-07-03 01:43:38 +04:00
# The name of the imported targets, i.e. the prefix "Qt4::" must not change,
# since it is stored in EXPORT-files as name of a required library. If the name would change
# here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore.
2012-08-13 21:47:32 +04:00
if ( QT_ ${ basename } _LIBRARY_RELEASE OR QT_ ${ basename } _LIBRARY_DEBUG )
2010-07-03 01:43:38 +04:00
2012-08-13 21:47:32 +04:00
if ( NOT TARGET Qt4:: ${ _camelCaseBasename } )
add_library ( Qt4:: ${ _camelCaseBasename } UNKNOWN IMPORTED )
2010-07-03 01:43:38 +04:00
2012-08-13 21:47:32 +04:00
if ( QT_ ${ basename } _LIBRARY_RELEASE )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE )
2011-06-14 03:21:41 +04:00
if ( QT_USE_FRAMEWORKS )
2012-08-13 21:47:32 +04:00
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}/${_camelCaseBasename}" )
2011-06-14 03:21:41 +04:00
else ( )
2012-08-13 21:47:32 +04:00
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" )
2011-06-14 03:21:41 +04:00
endif ( )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
2012-08-13 21:47:32 +04:00
if ( QT_ ${ basename } _LIBRARY_DEBUG )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG )
2011-06-14 03:21:41 +04:00
if ( QT_USE_FRAMEWORKS )
2012-08-13 21:47:32 +04:00
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}/${_camelCaseBasename}" )
2011-06-14 03:21:41 +04:00
else ( )
2012-08-13 21:47:32 +04:00
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" )
2011-06-14 03:21:41 +04:00
endif ( )
2012-08-13 21:50:14 +04:00
endif ( )
2012-12-31 03:55:38 +04:00
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S
" $ { Q T _ $ { b a s e n a m e } _ I N C L U D E _ D I R } "
)
string ( REGEX REPLACE "^QT" "" _stemname ${ basename } )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY
I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S
" Q T _ $ { _ s t e m n a m e } _ L I B "
)
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
# If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these
# imported targets. This works better in general, and is also in almost all cases fully
# backward compatible. The only issue is when a project A which had this enabled then exports its
2012-08-13 21:47:32 +04:00
# libraries via export or export_library_dependencies(). In this case the libraries from project
2010-07-03 01:43:38 +04:00
# A will depend on the imported Qt targets, and the names of these imported targets will be stored
# in the dependency files on disk. This means when a project B then uses project A, these imported
# targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a
# library file on disk, and not as a target, and linking will fail:
2012-08-13 21:47:32 +04:00
if ( QT_USE_IMPORTED_TARGETS )
set ( QT_ ${ basename } _LIBRARY Qt4:: ${ _camelCaseBasename } )
set ( QT_ ${ basename } _LIBRARIES Qt4:: ${ _camelCaseBasename } )
2012-08-13 21:50:14 +04:00
else ( )
2010-07-03 01:43:38 +04:00
# if the release- as well as the debug-version of the library have been found:
2012-08-13 21:47:32 +04:00
if ( QT_ ${ basename } _LIBRARY_DEBUG AND QT_ ${ basename } _LIBRARY_RELEASE )
2010-07-03 01:43:38 +04:00
# if the generator supports configuration types then set
# optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
2012-08-13 21:47:32 +04:00
if ( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
set ( QT_ ${ basename } _LIBRARY optimized ${ QT_${basename } _LIBRARY_RELEASE} debug ${ QT_${basename } _LIBRARY_DEBUG} )
2012-08-13 21:50:14 +04:00
else ( )
2010-07-03 01:43:38 +04:00
# if there are no configuration types and CMAKE_BUILD_TYPE has no value
# then just use the release libraries
2012-08-13 21:47:32 +04:00
set ( QT_ ${ basename } _LIBRARY ${ QT_${basename } _LIBRARY_RELEASE} )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
set ( QT_ ${ basename } _LIBRARIES optimized ${ QT_${basename } _LIBRARY_RELEASE} debug ${ QT_${basename } _LIBRARY_DEBUG} )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
# if only the release version was found, set the debug variable also to the release version
2012-08-13 21:47:32 +04:00
if ( QT_ ${ basename } _LIBRARY_RELEASE AND NOT QT_ ${ basename } _LIBRARY_DEBUG )
set ( QT_ ${ basename } _LIBRARY_DEBUG ${ QT_${basename } _LIBRARY_RELEASE} )
set ( QT_ ${ basename } _LIBRARY ${ QT_${basename } _LIBRARY_RELEASE} )
set ( QT_ ${ basename } _LIBRARIES ${ QT_${basename } _LIBRARY_RELEASE} )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
# if only the debug version was found, set the release variable also to the debug version
2012-08-13 21:47:32 +04:00
if ( QT_ ${ basename } _LIBRARY_DEBUG AND NOT QT_ ${ basename } _LIBRARY_RELEASE )
set ( QT_ ${ basename } _LIBRARY_RELEASE ${ QT_${basename } _LIBRARY_DEBUG} )
set ( QT_ ${ basename } _LIBRARY ${ QT_${basename } _LIBRARY_DEBUG} )
set ( QT_ ${ basename } _LIBRARIES ${ QT_${basename } _LIBRARY_DEBUG} )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
# put the value in the cache:
2012-08-13 21:47:32 +04:00
set ( QT_ ${ basename } _LIBRARY ${ QT_${basename } _LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE )
2010-07-03 01:43:38 +04:00
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
2012-08-13 21:47:32 +04:00
set ( QT_ ${ basename } _FOUND 1 )
2010-07-03 01:43:38 +04:00
2012-08-13 21:50:14 +04:00
else ( )
2010-07-06 23:24:53 +04:00
2012-08-13 21:47:32 +04:00
set ( QT_ ${ basename } _LIBRARY "" CACHE STRING "The Qt ${basename} library" FORCE )
2010-07-06 23:24:53 +04:00
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
2012-08-13 21:47:32 +04:00
if ( QT_ ${ basename } _INCLUDE_DIR )
2010-07-03 01:43:38 +04:00
#add the include directory to QT_INCLUDES
2012-08-13 21:47:32 +04:00
set ( QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${ QT_INCLUDES } )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
2012-11-07 20:13:09 +04:00
# Make variables changeable to the advanced user
2012-08-13 21:47:32 +04:00
mark_as_advanced ( QT_ ${ basename } _LIBRARY QT_ ${ basename } _LIBRARY_RELEASE QT_ ${ basename } _LIBRARY_DEBUG QT_ ${ basename } _INCLUDE_DIR )
2012-08-13 21:50:14 +04:00
endmacro ( )
2010-07-03 01:43:38 +04:00
2010-10-09 06:55:55 +04:00
function ( _QT4_QUERY_QMAKE VAR RESULT )
2011-01-18 05:14:22 +03:00
execute_process ( COMMAND "${QT_QMAKE_EXECUTABLE}" -query ${ VAR }
R E S U L T _ V A R I A B L E r e t u r n _ c o d e
2012-08-24 19:54:31 +04:00
O U T P U T _ V A R I A B L E o u t p u t
2011-01-18 05:14:22 +03:00
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E E R R O R _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
2010-10-09 06:55:55 +04:00
if ( NOT return_code )
file ( TO_CMAKE_PATH "${output}" output )
set ( ${ RESULT } ${ output } PARENT_SCOPE )
2012-08-13 21:50:14 +04:00
endif ( )
endfunction ( )
2010-10-09 06:55:55 +04:00
2013-03-05 20:32:55 +04:00
function ( _QT4_GET_VERSION_COMPONENTS VERSION RESULT_MAJOR RESULT_MINOR RESULT_PATCH )
string ( REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}" )
string ( REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}" )
string ( REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}" )
2010-07-03 01:43:38 +04:00
2013-03-05 20:32:55 +04:00
set ( ${ RESULT_MAJOR } ${ QT_VERSION_MAJOR } PARENT_SCOPE )
set ( ${ RESULT_MINOR } ${ QT_VERSION_MINOR } PARENT_SCOPE )
set ( ${ RESULT_PATCH } ${ QT_VERSION_PATCH } PARENT_SCOPE )
endfunction ( )
2006-04-27 23:07:23 +04:00
2013-03-05 20:32:55 +04:00
function ( _QT4_FIND_QMAKE QMAKE_NAMES QMAKE_RESULT VERSION_RESULT )
list ( LENGTH QMAKE_NAMES QMAKE_NAMES_LEN )
if ( ${ QMAKE_NAMES_LEN } EQUAL 0 )
return ( )
2012-08-13 21:50:14 +04:00
endif ( )
2013-03-05 20:32:55 +04:00
list ( GET QMAKE_NAMES 0 QMAKE_NAME )
2008-10-14 06:12:54 +04:00
2013-03-05 20:32:55 +04:00
get_filename_component ( qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME )
find_program ( QT_QMAKE_EXECUTABLE NAMES ${ QMAKE_NAME }
P A T H S
E N V Q T D I R
" [ 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 \ \ $ { q t _ i n s t a l l _ v e r s i o n } ; I n s t a l l D i r ] "
P A T H _ S U F F I X E S b i n
D O C " T h e q m a k e e x e c u t a b l e f o r t h e Q t i n s t a l l a t i o n t o u s e "
)
set ( major 0 )
if ( QT_QMAKE_EXECUTABLE )
_qt4_query_qmake ( QT_VERSION QTVERSION )
_qt4_get_version_components ( "${QTVERSION}" major minor patch )
endif ( )
2008-10-14 06:12:54 +04:00
2013-03-05 20:32:55 +04:00
if ( NOT QT_QMAKE_EXECUTABLE OR NOT "${major}" EQUAL 4 )
set ( curr_qmake "${QT_QMAKE_EXECUTABLE}" )
set ( curr_qt_version "${QTVERSION}" )
2007-12-16 13:49:23 +03:00
2012-08-13 21:47:32 +04:00
set ( QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE )
2013-03-05 20:32:55 +04:00
list ( REMOVE_AT QMAKE_NAMES 0 )
_qt4_find_qmake ( "${QMAKE_NAMES}" QMAKE QTVERSION )
_qt4_get_version_components ( "${QTVERSION}" major minor patch )
if ( NOT ${ major } EQUAL 4 )
# Restore possibly found qmake and it's version; these are used later
# in error message if incorrect version is found
set ( QT_QMAKE_EXECUTABLE "${curr_qmake}" CACHE FILEPATH "" FORCE )
set ( QTVERSION "${curr_qt_version}" )
2012-08-13 21:50:14 +04:00
endif ( )
2013-03-05 20:32:55 +04:00
2012-08-13 21:50:14 +04:00
endif ( )
2007-01-05 00:35:47 +03:00
2013-03-05 20:32:55 +04:00
2013-03-13 15:54:36 +04:00
set ( ${ QMAKE_RESULT } "${QT_QMAKE_EXECUTABLE}" PARENT_SCOPE )
2013-03-05 20:32:55 +04:00
set ( ${ VERSION_RESULT } "${QTVERSION}" PARENT_SCOPE )
endfunction ( )
set ( QT4_INSTALLED_VERSION_TOO_OLD FALSE )
set ( _QT4_QMAKE_NAMES qmake qmake4 qmake-qt4 qmake-mac )
_qt4_find_qmake ( "${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION )
2006-04-27 23:07:23 +04:00
2014-06-25 17:57:27 +04:00
if ( QT_QMAKE_EXECUTABLE AND
Q T V E R S I O N V E R S I O N _ G R E A T E R 3 A N D Q T V E R S I O N V E R S I O N _ L E S S 5 )
2006-04-27 23:07:23 +04:00
2014-01-29 19:57:09 +04:00
if ( Qt5Core_FOUND )
# Qt5CoreConfig sets QT_MOC_EXECUTABLE as a non-cache variable to the Qt 5
# path to moc. Unset that variable when Qt 4 and 5 are used together, so
# that when find_program looks for moc, it is not set to the Qt 5 version.
# If FindQt4 has already put the Qt 4 path in the cache, the unset()
# command 'unhides' the (correct) cache variable.
unset ( QT_MOC_EXECUTABLE )
endif ( )
2013-12-06 02:21:03 +04:00
if ( QT_QMAKE_EXECUTABLE_LAST )
string ( COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED )
endif ( )
set ( QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE )
2013-03-05 20:32:55 +04:00
_qt4_get_version_components ( "${QTVERSION}" QT_VERSION_MAJOR QT_VERSION_MINOR QT_VERSION_PATCH )
2013-01-07 22:06:35 +04:00
2010-07-03 01:43:38 +04:00
# ask qmake for the mkspecs directory
# we do this first because QT_LIBINFIX might be set
2012-08-13 21:47:32 +04:00
if ( NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED )
2010-10-09 06:55:55 +04:00
_qt4_query_qmake ( QMAKE_MKSPECS qt_mkspecs_dirs )
2010-07-03 01:43:38 +04:00
# do not replace : on windows as it might be a drive letter
# and windows should already use ; as a separator
2012-08-13 21:47:32 +04:00
if ( NOT WIN32 )
string ( REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}" )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
set ( qt_cross_paths )
foreach ( qt_cross_path ${ CMAKE_FIND_ROOT_PATH } )
set ( qt_cross_paths ${ qt_cross_paths } "${qt_cross_path}/mkspecs" )
2012-08-13 21:50:14 +04:00
endforeach ( )
2012-08-13 21:47:32 +04:00
set ( QT_MKSPECS_DIR NOTFOUND )
find_path ( QT_MKSPECS_DIR NAMES qconfig.pri
2010-07-03 01:43:38 +04:00
H I N T S $ { q t _ c r o s s _ p a t h s } $ { q t _ m k s p e c s _ d i r s }
2014-01-08 17:01:58 +04:00
D O C " T h e l o c a t i o n o f t h e Q t m k s p e c s c o n t a i n i n g q c o n f i g . p r i "
N O _ C M A K E _ F I N D _ R O O T _ P A T H )
2012-08-13 21:47:32 +04:00
endif ( )
if ( EXISTS "${QT_MKSPECS_DIR}/qconfig.pri" )
file ( READ ${ QT_MKSPECS_DIR } /qconfig.pri _qconfig_FILE_contents )
string ( REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}" )
string ( REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}" )
string ( REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}" )
string ( REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}" )
string ( REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}" )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
if ( "${QT_EDITION}" MATCHES "DesktopLight" )
set ( QT_EDITION_DESKTOPLIGHT 1 )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
# ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the
# others and for setting QT_LIBRARY_DIR
2012-08-13 21:47:32 +04:00
if ( NOT ( QT_QTCORE_LIBRARY_RELEASE OR QT_QTCORE_LIBRARY_DEBUG ) OR QT_QMAKE_CHANGED )
2010-10-09 06:55:55 +04:00
_qt4_query_qmake ( QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP )
2012-08-13 21:47:32 +04:00
set ( QT_QTCORE_LIBRARY_RELEASE NOTFOUND )
set ( QT_QTCORE_LIBRARY_DEBUG NOTFOUND )
find_library ( QT_QTCORE_LIBRARY_RELEASE
2010-07-03 01:43:38 +04:00
N A M E S Q t C o r e $ { Q T _ L I B I N F I X } Q t C o r e $ { Q T _ L I B I N F I X } 4
H I N T S $ { Q T _ L I B R A R Y _ D I R _ T M P }
2011-02-20 01:30:02 +03:00
N O _ D E F A U L T _ P A T H
2010-07-03 01:43:38 +04:00
)
2012-08-13 21:47:32 +04:00
find_library ( QT_QTCORE_LIBRARY_DEBUG
2010-07-03 01:43:38 +04:00
N A M E S Q t C o r e $ { Q T _ L I B I N F I X } _ d e b u g Q t C o r e $ { Q T _ L I B I N F I X } d Q t C o r e $ { Q T _ L I B I N F I X } d 4
H I N T S $ { Q T _ L I B R A R Y _ D I R _ T M P }
2011-02-20 01:30:02 +03:00
N O _ D E F A U L T _ P A T H
2010-07-03 01:43:38 +04:00
)
2010-07-15 20:23:32 +04:00
2012-08-13 21:47:32 +04:00
if ( NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG )
find_library ( QT_QTCORE_LIBRARY_RELEASE
2011-02-20 01:30:02 +03:00
N A M E S Q t C o r e $ { Q T _ L I B I N F I X } Q t C o r e $ { Q T _ L I B I N F I X } 4
H I N T S $ { Q T _ L I B R A R Y _ D I R _ T M P }
)
2012-08-13 21:47:32 +04:00
find_library ( QT_QTCORE_LIBRARY_DEBUG
2011-02-20 01:30:02 +03:00
N A M E S Q t C o r e $ { Q T _ L I B I N F I X } _ d e b u g Q t C o r e $ { Q T _ L I B I N F I X } d Q t C o r e $ { Q T _ L I B I N F I X } d 4
H I N T S $ { Q T _ L I B R A R Y _ D I R _ T M P }
)
2012-08-13 21:50:14 +04:00
endif ( )
2011-02-20 01:30:02 +03:00
2013-05-04 16:53:26 +04:00
# try dropping a hint if trying to use Visual Studio with Qt built by MinGW
2012-08-13 21:47:32 +04:00
if ( NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC )
if ( EXISTS ${ QT_LIBRARY_DIR_TMP } /libqtmain.a )
2013-05-04 16:53:26 +04:00
message ( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by MinGW. Those compilers do not produce code compatible with each other." )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
2010-07-15 20:23:32 +04:00
2012-08-13 21:47:32 +04:00
endif ( )
2011-06-14 03:21:41 +04:00
2010-07-03 01:43:38 +04:00
# set QT_LIBRARY_DIR based on location of QtCore found.
2012-08-13 21:47:32 +04:00
if ( QT_QTCORE_LIBRARY_RELEASE )
get_filename_component ( QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_RELEASE}" PATH )
set ( QT_LIBRARY_DIR ${ QT_LIBRARY_DIR_TMP } CACHE INTERNAL "Qt library dir" FORCE )
set ( QT_QTCORE_FOUND 1 )
elseif ( QT_QTCORE_LIBRARY_DEBUG )
get_filename_component ( QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_DEBUG}" PATH )
set ( QT_LIBRARY_DIR ${ QT_LIBRARY_DIR_TMP } CACHE INTERNAL "Qt library dir" FORCE )
set ( QT_QTCORE_FOUND 1 )
else ( )
2014-03-30 06:22:54 +04:00
if ( NOT Qt4_FIND_QUIETLY )
message ( WARNING
" $ { Q T _ Q M A K E _ E X E C U T A B L E } r e p o r t e d Q T _ I N S T A L L _ L I B S a s "
" \ " $ { Q T _ L I B R A R Y _ D I R _ T M P } \ " "
" b u t Q t C o r e c o u l d n o t b e f o u n d t h e r e . "
" Q t i s N O T i n s t a l l e d c o r r e c t l y f o r t h e t a r g e t b u i l d e n v i r o n m e n t . " )
endif ( )
2013-05-15 18:17:41 +04:00
set ( Qt4_FOUND FALSE )
2012-08-13 21:47:32 +04:00
if ( Qt4_FIND_REQUIRED )
message ( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details." )
2013-05-15 18:17:41 +04:00
else ( )
return ( )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
endif ( )
2010-07-03 01:43:38 +04:00
2006-04-27 23:07:23 +04:00
# ask qmake for the binary dir
2012-08-13 21:47:32 +04:00
if ( NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED )
2010-10-09 06:55:55 +04:00
_qt4_query_qmake ( QT_INSTALL_BINS qt_bins )
2012-08-13 21:47:32 +04:00
set ( QT_BINARY_DIR ${ qt_bins } CACHE INTERNAL "" FORCE )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
if ( APPLE )
set ( CMAKE_FIND_FRAMEWORK_OLD ${ CMAKE_FIND_FRAMEWORK } )
if ( EXISTS ${ QT_LIBRARY_DIR } /QtCore.framework )
set ( QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE )
set ( CMAKE_FIND_FRAMEWORK FIRST )
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
set ( QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE )
set ( CMAKE_FIND_FRAMEWORK LAST )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
2011-07-25 22:30:30 +04:00
2006-04-27 23:07:23 +04:00
# ask qmake for the include dir
2012-08-13 21:47:32 +04:00
if ( QT_LIBRARY_DIR AND ( NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED ) )
2010-10-09 06:55:55 +04:00
_qt4_query_qmake ( QT_INSTALL_HEADERS qt_headers )
2012-08-13 21:47:32 +04:00
set ( QT_QTCORE_INCLUDE_DIR NOTFOUND )
find_path ( QT_QTCORE_INCLUDE_DIR QtCore
2011-02-20 01:30:02 +03:00
H I N T S $ { q t _ h e a d e r s } $ { Q T _ L I B R A R Y _ D I R }
2011-07-22 23:38:36 +04:00
P A T H _ S U F F I X E S Q t C o r e q t 4 / Q t C o r e
2013-03-15 18:32:43 +04:00
N O _ D E F A U L T _ P A T H
2010-07-03 01:43:38 +04:00
)
2013-03-15 18:32:43 +04:00
if ( NOT QT_QTCORE_INCLUDE_DIR )
find_path ( QT_QTCORE_INCLUDE_DIR QtCore
H I N T S $ { q t _ h e a d e r s } $ { Q T _ L I B R A R Y _ D I R }
P A T H _ S U F F I X E S Q t C o r e q t 4 / Q t C o r e
)
endif ( )
2010-07-03 01:43:38 +04:00
# Set QT_HEADERS_DIR based on finding QtCore header
2012-08-13 21:47:32 +04:00
if ( QT_QTCORE_INCLUDE_DIR )
if ( QT_USE_FRAMEWORKS )
set ( QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE )
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
get_filename_component ( qt_headers "${QT_QTCORE_INCLUDE_DIR}/../" ABSOLUTE )
set ( QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
elseif ( )
message ( "Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_HEADERS as ${qt_headers}" )
message ( "Warning: But QtCore couldn't be found. Qt must NOT be installed correctly." )
endif ( )
endif ( )
if ( APPLE )
set ( CMAKE_FIND_FRAMEWORK ${ CMAKE_FIND_FRAMEWORK_OLD } )
2012-08-13 21:50:14 +04:00
endif ( )
2011-02-20 01:30:02 +03:00
2010-07-03 01:43:38 +04:00
# Set QT_INCLUDE_DIR based on QT_HEADERS_DIR
2012-08-13 21:47:32 +04:00
if ( QT_HEADERS_DIR )
if ( QT_USE_FRAMEWORKS )
2010-07-03 01:43:38 +04:00
# Qt/Mac frameworks has two include dirs.
# One is the framework include for which CMake will add a -F flag
# and the other is an include dir for non-framework Qt modules
2012-08-13 21:47:32 +04:00
set ( QT_INCLUDE_DIR ${ QT_HEADERS_DIR } ${ QT_QTCORE_LIBRARY_RELEASE } )
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
set ( QT_INCLUDE_DIR ${ QT_HEADERS_DIR } )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
2010-07-03 01:43:38 +04:00
# Set QT_INCLUDES
2012-08-13 21:47:32 +04:00
set ( QT_INCLUDES ${ QT_MKSPECS_DIR } /default ${ QT_INCLUDE_DIR } ${ QT_QTCORE_INCLUDE_DIR } )
2006-04-27 23:07:23 +04:00
# ask qmake for the documentation directory
2012-08-13 21:47:32 +04:00
if ( QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED )
2010-10-09 06:55:55 +04:00
_qt4_query_qmake ( QT_INSTALL_DOCS qt_doc_dir )
2012-08-13 21:47:32 +04:00
set ( QT_DOC_DIR ${ qt_doc_dir } CACHE PATH "The location of the Qt docs" FORCE )
2012-08-13 21:50:14 +04:00
endif ( )
2006-04-27 23:07:23 +04:00
2006-10-13 19:23:44 +04:00
# ask qmake for the plugins directory
2012-08-13 21:47:32 +04:00
if ( QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED )
2010-10-09 06:55:55 +04:00
_qt4_query_qmake ( QT_INSTALL_PLUGINS qt_plugins_dir )
2012-08-13 21:47:32 +04:00
set ( QT_PLUGINS_DIR NOTFOUND )
2010-07-07 00:37:16 +04:00
foreach ( qt_cross_path ${ CMAKE_FIND_ROOT_PATH } )
set ( qt_cross_paths ${ qt_cross_paths } "${qt_cross_path}/plugins" )
2012-08-13 21:50:14 +04:00
endforeach ( )
2012-08-13 21:47:32 +04:00
find_path ( QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer
2010-07-07 00:37:16 +04:00
H I N T S $ { q t _ c r o s s _ p a t h s } $ { q t _ p l u g i n s _ d i r }
2014-01-08 17:01:58 +04:00
D O C " T h e l o c a t i o n o f t h e Q t p l u g i n s "
N O _ C M A K E _ F I N D _ R O O T _ P A T H )
2012-08-13 21:50:14 +04:00
endif ( )
2008-12-16 02:48:48 +03:00
# ask qmake for the translations directory
2012-08-13 21:47:32 +04:00
if ( QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED )
2010-10-09 06:55:55 +04:00
_qt4_query_qmake ( QT_INSTALL_TRANSLATIONS qt_translations_dir )
2012-08-13 21:47:32 +04:00
set ( QT_TRANSLATIONS_DIR ${ qt_translations_dir } CACHE PATH "The location of the Qt translations" FORCE )
2012-08-13 21:50:14 +04:00
endif ( )
2008-12-16 02:48:48 +03:00
2010-10-09 06:55:55 +04:00
# ask qmake for the imports directory
2012-08-13 21:47:32 +04:00
if ( QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED )
2010-10-09 06:55:55 +04:00
_qt4_query_qmake ( QT_INSTALL_IMPORTS qt_imports_dir )
if ( qt_imports_dir )
2012-08-13 21:47:32 +04:00
set ( QT_IMPORTS_DIR NOTFOUND )
2010-10-09 06:55:55 +04:00
foreach ( qt_cross_path ${ CMAKE_FIND_ROOT_PATH } )
set ( qt_cross_paths ${ qt_cross_paths } "${qt_cross_path}/imports" )
2012-08-13 21:50:14 +04:00
endforeach ( )
2012-08-13 21:47:32 +04:00
find_path ( QT_IMPORTS_DIR NAMES Qt
2010-10-09 06:55:55 +04:00
H I N T S $ { q t _ c r o s s _ p a t h s } $ { q t _ i m p o r t s _ d i r }
D O C " T h e l o c a t i o n o f t h e Q t i m p o r t s "
2014-01-08 17:01:58 +04:00
N O _ C M A K E _ F I N D _ R O O T _ P A T H
2010-10-09 06:55:55 +04:00
N O _ C M A K E _ P A T H N O _ C M A K E _ E N V I R O N M E N T _ P A T H N O _ S Y S T E M _ E N V I R O N M E N T _ P A T H
N O _ C M A K E _ S Y S T E M _ P A T H )
mark_as_advanced ( QT_IMPORTS_DIR )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
2010-10-09 06:55:55 +04:00
2012-11-07 20:13:09 +04:00
# Make variables changeable to the advanced user
2012-08-13 21:47:32 +04:00
mark_as_advanced ( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR
2009-11-08 21:01:46 +03:00
Q T _ P L U G I N S _ D I R Q T _ T R A N S L A T I O N S _ D I R )
2010-07-03 01:43:38 +04:00
2009-11-17 22:44:33 +03:00
#############################################
#
# Find out what window system we're using
#
#############################################
2014-03-30 06:22:54 +04:00
cmake_push_check_state ( )
2009-11-17 22:44:33 +03:00
# Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
2012-08-13 21:47:32 +04:00
set ( CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}" )
2014-03-30 06:22:54 +04:00
set ( CMAKE_REQUIRED_QUIET ${ Qt4_FIND_QUIETLY } )
2009-11-17 22:44:33 +03:00
# Check for Window system symbols (note: only one should end up being set)
2011-07-28 22:15:46 +04:00
CHECK_CXX_SYMBOL_EXISTS ( Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11 )
CHECK_CXX_SYMBOL_EXISTS ( Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN )
CHECK_CXX_SYMBOL_EXISTS ( Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS )
CHECK_CXX_SYMBOL_EXISTS ( Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC )
2012-08-13 21:47:32 +04:00
if ( Q_WS_MAC )
if ( QT_QMAKE_CHANGED )
unset ( QT_MAC_USE_COCOA CACHE )
2012-08-13 21:50:14 +04:00
endif ( )
2011-07-28 22:15:46 +04:00
CHECK_CXX_SYMBOL_EXISTS ( QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA )
2012-08-13 21:50:14 +04:00
endif ( )
2009-11-17 22:44:33 +03:00
2012-08-13 21:47:32 +04:00
if ( QT_QTCOPY_REQUIRED )
2011-07-28 22:15:46 +04:00
CHECK_CXX_SYMBOL_EXISTS ( QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY )
2012-08-13 21:47:32 +04:00
if ( NOT QT_IS_QTCOPY )
message ( FATAL_ERROR "qt-copy is required, but hasn't been found" )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
2009-11-17 22:44:33 +03:00
2014-03-30 06:22:54 +04:00
cmake_pop_check_state ( )
2009-11-17 22:44:33 +03:00
#
#############################################
2005-09-12 17:00:55 +04:00
########################################
#
# Setting the INCLUDE-Variables
#
########################################
2006-04-27 23:07:23 +04:00
2012-08-13 21:47:32 +04:00
set ( QT_MODULES QtGui Qt3Support QtSvg QtScript QtTest QtUiTools
2009-12-20 17:06:42 +03:00
Q t H e l p Q t W e b K i t Q t X m l P a t t e r n s p h o n o n Q t N e t w o r k Q t M u l t i m e d i a
2010-02-18 03:12:18 +03:00
Q t N s P l u g i n Q t O p e n G L Q t S q l Q t X m l Q t D e s i g n e r Q t D B u s Q t S c r i p t T o o l s
Q t D e c l a r a t i v e )
2012-08-13 21:42:58 +04:00
2012-08-13 21:47:32 +04:00
if ( Q_WS_X11 )
set ( QT_MODULES ${ QT_MODULES } QtMotif )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
if ( QT_QMAKE_CHANGED )
foreach ( QT_MODULE ${ QT_MODULES } )
string ( TOUPPER ${ QT_MODULE } _upper_qt_module )
set ( QT_ ${ _upper_qt_module } _INCLUDE_DIR NOTFOUND )
set ( QT_ ${ _upper_qt_module } _LIBRARY_RELEASE NOTFOUND )
set ( QT_ ${ _upper_qt_module } _LIBRARY_DEBUG NOTFOUND )
2012-08-13 21:50:14 +04:00
endforeach ( )
2012-08-13 21:47:32 +04:00
set ( QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR NOTFOUND )
set ( QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NOTFOUND )
set ( QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NOTFOUND )
set ( QT_QTASSISTANTCLIENT_INCLUDE_DIR NOTFOUND )
set ( QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NOTFOUND )
set ( QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NOTFOUND )
set ( QT_QTASSISTANT_INCLUDE_DIR NOTFOUND )
set ( QT_QTASSISTANT_LIBRARY_RELEASE NOTFOUND )
set ( QT_QTASSISTANT_LIBRARY_DEBUG NOTFOUND )
set ( QT_QTCLUCENE_LIBRARY_RELEASE NOTFOUND )
set ( QT_QTCLUCENE_LIBRARY_DEBUG NOTFOUND )
set ( QT_QAXCONTAINER_INCLUDE_DIR NOTFOUND )
set ( QT_QAXCONTAINER_LIBRARY_RELEASE NOTFOUND )
set ( QT_QAXCONTAINER_LIBRARY_DEBUG NOTFOUND )
set ( QT_QAXSERVER_INCLUDE_DIR NOTFOUND )
set ( QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND )
set ( QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND )
if ( Q_WS_WIN )
set ( QT_QTMAIN_LIBRARY_DEBUG NOTFOUND )
set ( QT_QTMAIN_LIBRARY_RELEASE NOTFOUND )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
2012-08-13 21:47:32 +04:00
foreach ( QT_MODULE ${ QT_MODULES } )
string ( TOUPPER ${ QT_MODULE } _upper_qt_module )
find_path ( QT_ ${ _upper_qt_module } _INCLUDE_DIR ${ QT_MODULE }
2008-10-14 06:12:54 +04:00
P A T H S
$ { Q T _ H E A D E R S _ D I R } / $ { Q T _ M O D U L E }
$ { Q T _ L I B R A R Y _ D I R } / $ { Q T _ M O D U L E } . f r a m e w o r k / H e a d e r s
2011-03-11 00:17:13 +03:00
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2008-10-14 06:12:54 +04:00
)
2010-01-14 01:34:31 +03:00
# phonon doesn't seem consistent, let's try phonondefs.h for some
# installations
2012-08-13 21:47:32 +04:00
if ( ${ QT_MODULE } STREQUAL "phonon" )
find_path ( QT_ ${ _upper_qt_module } _INCLUDE_DIR phonondefs.h
2010-01-14 01:34:31 +03:00
P A T H S
$ { Q T _ H E A D E R S _ D I R } / $ { Q T _ M O D U L E }
$ { Q T _ L I B R A R Y _ D I R } / $ { Q T _ M O D U L E } . f r a m e w o r k / H e a d e r s
2011-03-11 00:17:13 +03:00
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2010-01-14 01:34:31 +03:00
)
2012-08-13 21:50:14 +04:00
endif ( )
endforeach ( )
2009-11-08 21:01:46 +03:00
2012-08-13 21:47:32 +04:00
if ( Q_WS_WIN )
2013-07-24 19:59:13 +04:00
set ( QT_MODULES ${ QT_MODULES } QAxContainer QAxServer )
2013-07-22 16:27:22 +04:00
# Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR
find_path ( QT_QAXCONTAINER_INCLUDE_DIR ActiveQt
P A T H S $ { Q T _ H E A D E R S _ D I R } / A c t i v e Q t
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
find_path ( QT_QAXSERVER_INCLUDE_DIR ActiveQt
P A T H S $ { Q T _ H E A D E R S _ D I R } / A c t i v e Q t
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
2012-08-13 21:50:14 +04:00
endif ( )
2009-11-08 21:01:46 +03:00
2008-10-14 06:12:54 +04:00
# Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR
2012-08-13 21:47:32 +04:00
find_path ( QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents
2008-05-23 23:25:26 +04:00
P A T H S
2009-01-26 18:12:37 +03:00
$ { Q T _ H E A D E R S _ D I R } / Q t D e s i g n e r
2008-10-14 06:12:54 +04:00
$ { Q T _ L I B R A R Y _ D I R } / Q t D e s i g n e r . f r a m e w o r k / H e a d e r s
2011-03-11 00:17:13 +03:00
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2006-10-04 18:33:10 +04:00
)
2012-08-13 21:42:58 +04:00
2008-10-20 21:31:50 +04:00
# Set QT_QTASSISTANT_INCLUDE_DIR
2012-08-13 21:47:32 +04:00
find_path ( QT_QTASSISTANT_INCLUDE_DIR QtAssistant
2008-10-20 21:31:50 +04:00
P A T H S
2009-01-26 18:12:37 +03:00
$ { Q T _ H E A D E R S _ D I R } / Q t A s s i s t a n t
2008-10-20 21:31:50 +04:00
$ { Q T _ L I B R A R Y _ D I R } / Q t A s s i s t a n t . f r a m e w o r k / H e a d e r s
2011-03-11 00:17:13 +03:00
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2008-10-20 21:31:50 +04:00
)
2012-08-13 21:42:58 +04:00
2008-10-14 06:12:54 +04:00
# Set QT_QTASSISTANTCLIENT_INCLUDE_DIR
2012-08-13 21:47:32 +04:00
find_path ( QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient
2008-10-14 06:12:54 +04:00
P A T H S
2009-01-26 18:12:37 +03:00
$ { Q T _ H E A D E R S _ D I R } / Q t A s s i s t a n t
2008-10-14 06:12:54 +04:00
$ { Q T _ L I B R A R Y _ D I R } / Q t A s s i s t a n t . f r a m e w o r k / H e a d e r s
2011-03-11 00:17:13 +03:00
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2008-10-14 06:12:54 +04:00
)
2009-11-08 21:01:46 +03:00
########################################
#
# Setting the LIBRARY-Variables
#
########################################
2009-10-02 00:48:19 +04:00
2008-10-14 06:12:54 +04:00
# find the libraries
2012-08-13 21:47:32 +04:00
foreach ( QT_MODULE ${ QT_MODULES } )
string ( TOUPPER ${ QT_MODULE } _upper_qt_module )
find_library ( QT_ ${ _upper_qt_module } _LIBRARY_RELEASE
2009-09-23 00:28:13 +04:00
N A M E S $ { Q T _ M O D U L E } $ { Q T _ L I B I N F I X } $ { Q T _ M O D U L E } $ { Q T _ L I B I N F I X } 4
2011-03-11 00:17:13 +03:00
P A T H S $ { Q T _ L I B R A R Y _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2008-10-14 06:12:54 +04:00
)
2012-08-13 21:47:32 +04:00
find_library ( QT_ ${ _upper_qt_module } _LIBRARY_DEBUG
2009-09-23 00:28:13 +04:00
N A M E S $ { Q T _ M O D U L E } $ { Q T _ L I B I N F I X } _ d e b u g $ { Q T _ M O D U L E } $ { Q T _ L I B I N F I X } d $ { Q T _ M O D U L E } $ { Q T _ L I B I N F I X } d 4
2011-03-11 00:17:13 +03:00
P A T H S $ { Q T _ L I B R A R Y _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2008-10-14 06:12:54 +04:00
)
2012-09-06 23:11:54 +04:00
if ( QT_ ${ _upper_qt_module } _LIBRARY_RELEASE MATCHES "/${QT_MODULE}\\.framework$" )
if ( NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_RELEASE}/${QT_MODULE}" )
# Release framework library file does not exist... Force to NOTFOUND:
set ( QT_ ${ _upper_qt_module } _LIBRARY_RELEASE "QT_${_upper_qt_module}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE )
endif ( )
endif ( )
if ( QT_ ${ _upper_qt_module } _LIBRARY_DEBUG MATCHES "/${QT_MODULE}\\.framework$" )
if ( NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_DEBUG}/${QT_MODULE}" )
# Debug framework library file does not exist... Force to NOTFOUND:
set ( QT_ ${ _upper_qt_module } _LIBRARY_DEBUG "QT_${_upper_qt_module}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE )
endif ( )
endif ( )
2012-08-13 21:50:14 +04:00
endforeach ( )
2005-09-12 17:00:55 +04:00
2011-08-29 18:23:44 +04:00
# QtUiTools is sometimes not in the same directory as the other found libraries
# e.g. on Mac, its never a framework like the others are
2012-08-13 21:47:32 +04:00
if ( QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE )
find_library ( QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools ${ QT_LIBINFIX } PATHS ${ QT_LIBRARY_DIR } )
2012-08-13 21:50:14 +04:00
endif ( )
2005-09-12 17:00:55 +04:00
2007-01-04 00:38:26 +03:00
# Set QT_QTDESIGNERCOMPONENTS_LIBRARY
2012-08-13 21:47:32 +04:00
find_library ( QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents ${ QT_LIBINFIX } QtDesignerComponents ${ QT_LIBINFIX } 4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
find_library ( QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents ${ QT_LIBINFIX } _debug QtDesignerComponents ${ QT_LIBINFIX } d QtDesignerComponents ${ QT_LIBINFIX } d4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
2007-01-04 00:38:26 +03:00
2006-08-01 17:12:18 +04:00
# Set QT_QTMAIN_LIBRARY
2012-08-13 21:47:32 +04:00
if ( Q_WS_WIN )
find_library ( QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain ${ QT_LIBINFIX } PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
find_library ( QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain ${ QT_LIBINFIX } d PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:42:58 +04:00
2008-03-13 22:29:28 +03:00
# Set QT_QTASSISTANTCLIENT_LIBRARY
2012-08-13 21:47:32 +04:00
find_library ( QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient ${ QT_LIBINFIX } QtAssistantClient ${ QT_LIBINFIX } 4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
find_library ( QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient ${ QT_LIBINFIX } _debug QtAssistantClient ${ QT_LIBINFIX } d QtAssistantClient ${ QT_LIBINFIX } d4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
2012-08-13 21:42:58 +04:00
2008-10-20 21:31:50 +04:00
# Set QT_QTASSISTANT_LIBRARY
2012-08-13 21:47:32 +04:00
find_library ( QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient ${ QT_LIBINFIX } QtAssistantClient ${ QT_LIBINFIX } 4 QtAssistant ${ QT_LIBINFIX } QtAssistant ${ QT_LIBINFIX } 4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
find_library ( QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient ${ QT_LIBINFIX } _debug QtAssistantClient ${ QT_LIBINFIX } d QtAssistantClient ${ QT_LIBINFIX } d4 QtAssistant ${ QT_LIBINFIX } _debug QtAssistant ${ QT_LIBINFIX } d4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
2008-03-13 22:29:28 +03:00
# Set QT_QTHELP_LIBRARY
2012-08-13 21:47:32 +04:00
find_library ( QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene ${ QT_LIBINFIX } QtCLucene ${ QT_LIBINFIX } 4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
find_library ( QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene ${ QT_LIBINFIX } _debug QtCLucene ${ QT_LIBINFIX } d QtCLucene ${ QT_LIBINFIX } d4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
if ( Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE )
find_library ( QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene ${ QT_LIBINFIX } PATHS ${ QT_LIBRARY_DIR } )
2012-08-13 21:50:14 +04:00
endif ( )
2008-03-13 22:29:28 +03:00
2010-07-03 01:43:38 +04:00
2005-09-12 17:00:55 +04:00
############################################
#
# Check the existence of the libraries.
#
############################################
2010-01-19 00:23:21 +03:00
2012-12-31 12:41:09 +04:00
macro ( _qt4_add_target_depends_internal _QT_MODULE _PROPERTY )
if ( TARGET Qt4:: ${ _QT_MODULE } )
foreach ( _DEPEND ${ ARGN } )
2013-02-27 01:03:04 +04:00
set ( _VALID_DEPENDS )
if ( TARGET Qt4::Qt ${ _DEPEND } )
list ( APPEND _VALID_DEPENDS Qt4::Qt ${ _DEPEND } )
2012-12-31 12:41:09 +04:00
endif ( )
2013-02-27 01:03:04 +04:00
if ( _VALID_DEPENDS )
set_property ( TARGET Qt4:: ${ _QT_MODULE } APPEND PROPERTY
$ { _ P R O P E R T Y }
" $ { _ V A L I D _ D E P E N D S } "
)
endif ( )
set ( _VALID_DEPENDS )
2012-12-31 12:41:09 +04:00
endforeach ( )
endif ( )
endmacro ( )
macro ( _qt4_add_target_depends _QT_MODULE )
2014-01-08 13:26:49 +04:00
if ( TARGET Qt4:: ${ _QT_MODULE } )
get_target_property ( _configs Qt4:: ${ _QT_MODULE } IMPORTED_CONFIGURATIONS )
_qt4_add_target_depends_internal ( ${ _QT_MODULE } INTERFACE_LINK_LIBRARIES ${ ARGN } )
foreach ( _config ${ _configs } )
_qt4_add_target_depends_internal ( ${ _QT_MODULE } IMPORTED_LINK_INTERFACE_LIBRARIES_ ${ _config } ${ ARGN } )
endforeach ( )
set ( _configs )
endif ( )
2012-12-31 12:41:09 +04:00
endmacro ( )
macro ( _qt4_add_target_private_depends _QT_MODULE )
2014-01-08 13:26:49 +04:00
if ( TARGET Qt4:: ${ _QT_MODULE } )
get_target_property ( _configs Qt4:: ${ _QT_MODULE } IMPORTED_CONFIGURATIONS )
foreach ( _config ${ _configs } )
_qt4_add_target_depends_internal ( ${ _QT_MODULE } IMPORTED_LINK_DEPENDENT_LIBRARIES_ ${ _config } ${ ARGN } )
endforeach ( )
set ( _configs )
endif ( )
2012-12-31 12:41:09 +04:00
endmacro ( )
2012-08-13 21:42:58 +04:00
# Set QT_xyz_LIBRARY variable and add
2007-01-04 01:32:02 +03:00
# library include path to QT_INCLUDES
2011-07-25 22:30:30 +04:00
_QT4_ADJUST_LIB_VARS ( QtCore )
2012-12-31 03:55:38 +04:00
set_property ( TARGET Qt4::QtCore APPEND PROPERTY
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S
" $ { Q T _ M K S P E C S _ D I R } / d e f a u l t "
$ { Q T _ I N C L U D E _ D I R }
)
2013-12-10 21:31:36 +04:00
set_property ( TARGET Qt4::QtCore APPEND PROPERTY
I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S
$ < $ < N O T : $ < C O N F I G : D e b u g > > : Q T _ N O _ D E B U G >
)
2013-03-16 21:25:59 +04:00
set_property ( TARGET Qt4::QtCore PROPERTY
I N T E R F A C E _ Q T _ M A J O R _ V E R S I O N 4
)
set_property ( TARGET Qt4::QtCore APPEND PROPERTY
C O M P A T I B L E _ I N T E R F A C E _ S T R I N G Q T _ M A J O R _ V E R S I O N
)
2011-07-25 22:30:30 +04:00
2012-08-13 21:47:32 +04:00
foreach ( QT_MODULE ${ QT_MODULES } )
2010-07-03 01:43:38 +04:00
_QT4_ADJUST_LIB_VARS ( ${ QT_MODULE } )
2012-12-31 12:41:09 +04:00
_qt4_add_target_depends ( ${ QT_MODULE } Core )
2012-08-13 21:50:14 +04:00
endforeach ( )
2010-07-03 01:43:38 +04:00
2010-01-19 00:23:21 +03:00
_QT4_ADJUST_LIB_VARS ( QtAssistant )
_QT4_ADJUST_LIB_VARS ( QtAssistantClient )
_QT4_ADJUST_LIB_VARS ( QtCLucene )
_QT4_ADJUST_LIB_VARS ( QtDesignerComponents )
2009-10-02 00:41:00 +04:00
# platform dependent libraries
2012-08-13 21:47:32 +04:00
if ( Q_WS_WIN )
2010-01-19 00:23:21 +03:00
_QT4_ADJUST_LIB_VARS ( qtmain )
2012-11-20 17:53:41 +04:00
2013-07-22 16:27:22 +04:00
_QT4_ADJUST_LIB_VARS ( QAxServer )
2013-05-23 19:02:05 +04:00
if ( QT_QAXSERVER_FOUND )
set_property ( TARGET Qt4::QAxServer PROPERTY
I N T E R F A C E _ Q T 4 _ N O _ L I N K _ Q T M A I N O N
)
set_property ( TARGET Qt4::QAxServer APPEND PROPERTY
C O M P A T I B L E _ I N T E R F A C E _ B O O L Q T 4 _ N O _ L I N K _ Q T M A I N )
endif ( )
2012-11-20 17:53:41 +04:00
2013-07-22 16:27:22 +04:00
_QT4_ADJUST_LIB_VARS ( QAxContainer )
2012-08-13 21:50:14 +04:00
endif ( )
2009-12-17 01:16:59 +03:00
2012-12-31 12:41:09 +04:00
# Only public dependencies are listed here.
# Eg, QtDBus links to QtXml, but users of QtDBus do not need to
# link to QtXml because QtDBus only uses it internally, not in public
# headers.
# Everything depends on QtCore, but that is covered above already
_qt4_add_target_depends ( Qt3Support Sql Gui Network )
2012-12-31 03:55:38 +04:00
if ( TARGET Qt4::Qt3Support )
# An additional define is required for QT3_SUPPORT
set_property ( TARGET Qt4::Qt3Support APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT3_SUPPORT )
endif ( )
2012-12-31 12:41:09 +04:00
_qt4_add_target_depends ( QtDeclarative Script Gui )
_qt4_add_target_depends ( QtDesigner Gui )
_qt4_add_target_depends ( QtHelp Gui )
_qt4_add_target_depends ( QtMultimedia Gui )
_qt4_add_target_depends ( QtOpenGL Gui )
_qt4_add_target_depends ( QtSvg Gui )
_qt4_add_target_depends ( QtWebKit Gui Network )
_qt4_add_target_private_depends ( Qt3Support Xml )
2013-05-23 19:02:05 +04:00
if ( QT_VERSION VERSION_GREATER 4.6 )
_qt4_add_target_private_depends ( QtSvg Xml )
endif ( )
2012-12-31 12:41:09 +04:00
_qt4_add_target_private_depends ( QtDBus Xml )
_qt4_add_target_private_depends ( QtUiTools Xml Gui )
_qt4_add_target_private_depends ( QtHelp Sql Xml Network )
_qt4_add_target_private_depends ( QtXmlPatterns Network )
_qt4_add_target_private_depends ( QtScriptTools Gui )
_qt4_add_target_private_depends ( QtWebKit XmlPatterns )
_qt4_add_target_private_depends ( QtDeclarative XmlPatterns Svg Sql Gui )
_qt4_add_target_private_depends ( QtMultimedia Gui )
_qt4_add_target_private_depends ( QtOpenGL Gui )
2013-05-23 19:02:05 +04:00
if ( QT_QAXSERVER_FOUND )
_qt4_add_target_private_depends ( QAxServer Gui )
endif ( )
if ( QT_QAXCONTAINER_FOUND )
_qt4_add_target_private_depends ( QAxContainer Gui )
endif ( )
2012-12-31 12:41:09 +04:00
_qt4_add_target_private_depends ( phonon Gui )
if ( QT_QTDBUS_FOUND )
_qt4_add_target_private_depends ( phonon DBus )
endif ( )
2006-09-06 16:31:50 +04:00
2012-11-20 17:53:41 +04:00
if ( WIN32 AND NOT QT4_NO_LINK_QTMAIN )
set ( _isExe $< STREQUAL:$<TARGET_PROPERTY:TYPE > ,EXECUTABLE> )
set ( _isWin32 $< BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE > > )
set ( _isNotExcluded $< NOT:$<BOOL:$<TARGET_PROPERTY:QT4_NO_LINK_QTMAIN > >> )
set ( _isPolicyNEW $< TARGET_POLICY:CMP0020 > )
2013-02-09 13:20:14 +04:00
get_target_property ( _configs Qt4::QtCore IMPORTED_CONFIGURATIONS )
2013-07-25 13:19:22 +04:00
set_property ( TARGET Qt4::QtCore APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S
$ < $ < A N D : $ { _ i s E x e } , $ { _ i s W i n 3 2 } , $ { _ i s N o t E x c l u d e d } , $ { _ i s P o l i c y N E W } > : Q t 4 : : q t m a i n >
)
2013-02-09 13:20:14 +04:00
foreach ( _config ${ _configs } )
set_property ( TARGET Qt4::QtCore APPEND PROPERTY
I M P O R T E D _ L I N K _ I N T E R F A C E _ L I B R A R I E S _ $ { _ c o n f i g }
$ < $ < A N D : $ { _ i s E x e } , $ { _ i s W i n 3 2 } , $ { _ i s N o t E x c l u d e d } , $ { _ i s P o l i c y N E W } > : Q t 4 : : q t m a i n >
)
endforeach ( )
unset ( _configs )
2012-11-20 17:53:41 +04:00
unset ( _isExe )
unset ( _isWin32 )
unset ( _isNotExcluded )
unset ( _isPolicyNEW )
endif ( )
2005-09-12 17:00:55 +04:00
#######################################
#
2012-08-13 21:42:58 +04:00
# Check the executables of Qt
2005-09-12 17:00:55 +04:00
# ( moc, uic, rcc )
#
#######################################
2005-07-15 20:14:47 +04:00
2005-09-12 17:00:55 +04:00
2012-08-13 21:47:32 +04:00
if ( QT_QMAKE_CHANGED )
set ( QT_UIC_EXECUTABLE NOTFOUND )
set ( QT_MOC_EXECUTABLE NOTFOUND )
set ( QT_UIC3_EXECUTABLE NOTFOUND )
set ( QT_RCC_EXECUTABLE NOTFOUND )
set ( QT_DBUSCPP2XML_EXECUTABLE NOTFOUND )
set ( QT_DBUSXML2CPP_EXECUTABLE NOTFOUND )
set ( QT_LUPDATE_EXECUTABLE NOTFOUND )
set ( QT_LRELEASE_EXECUTABLE NOTFOUND )
set ( QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND )
set ( QT_DESIGNER_EXECUTABLE NOTFOUND )
set ( QT_LINGUIST_EXECUTABLE NOTFOUND )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
2014-01-24 15:55:21 +04:00
macro ( _find_qt4_program VAR NAME )
find_program ( ${ VAR }
N A M E S $ { A R G N }
P A T H S $ { Q T _ B I N A R Y _ D I R }
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
if ( ${ VAR } AND NOT TARGET ${ NAME } )
add_executable ( ${ NAME } IMPORTED )
set_property ( TARGET ${ NAME } PROPERTY IMPORTED_LOCATION ${ ${VAR } } )
endif ( )
endmacro ( )
2009-11-24 01:53:50 +03:00
2014-05-20 19:47:54 +04:00
_find_qt4_program ( QT_MOC_EXECUTABLE Qt4::moc moc-qt4 moc4 moc )
_find_qt4_program ( QT_UIC_EXECUTABLE Qt4::uic uic-qt4 uic4 uic )
2014-01-24 15:55:21 +04:00
_find_qt4_program ( QT_UIC3_EXECUTABLE Qt4::uic3 uic3 )
_find_qt4_program ( QT_RCC_EXECUTABLE Qt4::rcc rcc )
_find_qt4_program ( QT_DBUSCPP2XML_EXECUTABLE Qt4::qdbuscpp2xml qdbuscpp2xml )
_find_qt4_program ( QT_DBUSXML2CPP_EXECUTABLE Qt4::qdbusxml2cpp qdbusxml2cpp )
2014-05-20 19:47:54 +04:00
_find_qt4_program ( QT_LUPDATE_EXECUTABLE Qt4::lupdate lupdate-qt4 lupdate4 lupdate )
_find_qt4_program ( QT_LRELEASE_EXECUTABLE Qt4::lrelease lrelease-qt4 lrelease4 lrelease )
2014-01-24 15:55:21 +04:00
_find_qt4_program ( QT_QCOLLECTIONGENERATOR_EXECUTABLE Qt4::qcollectiongenerator qcollectiongenerator-qt4 qcollectiongenerator )
2014-05-20 19:47:54 +04:00
_find_qt4_program ( QT_DESIGNER_EXECUTABLE Qt4::designer designer-qt4 designer4 designer )
_find_qt4_program ( QT_LINGUIST_EXECUTABLE Qt4::linguist linguist-qt4 linguist4 linguist )
2009-11-24 01:53:50 +03:00
2014-02-09 17:35:57 +04:00
if ( NOT TARGET Qt4::qmake )
add_executable ( Qt4::qmake IMPORTED )
set_property ( TARGET Qt4::qmake PROPERTY IMPORTED_LOCATION ${ QT_QMAKE_EXECUTABLE } )
endif ( )
2012-08-13 21:47:32 +04:00
if ( QT_MOC_EXECUTABLE )
set ( QT_WRAP_CPP "YES" )
2012-08-13 21:50:14 +04:00
endif ( )
2006-04-27 23:07:23 +04:00
2012-08-13 21:47:32 +04:00
if ( QT_UIC_EXECUTABLE )
set ( QT_WRAP_UI "YES" )
2012-08-13 21:50:14 +04:00
endif ( )
2006-04-27 23:07:23 +04:00
2012-08-13 21:47:32 +04:00
mark_as_advanced ( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE
2008-01-30 01:01:00 +03:00
Q T _ R C C _ E X E C U T A B L E Q T _ D B U S X M L 2 C P P _ E X E C U T A B L E Q T _ D B U S C P P 2 X M L _ E X E C U T A B L E
2009-11-24 01:53:50 +03:00
Q T _ L U P D A T E _ E X E C U T A B L E Q T _ L R E L E A S E _ E X E C U T A B L E Q T _ Q C O L L E C T I O N G E N E R A T O R _ E X E C U T A B L E
Q T _ D E S I G N E R _ E X E C U T A B L E Q T _ L I N G U I S T _ E X E C U T A B L E )
2005-09-12 17:00:55 +04:00
2009-11-15 21:02:19 +03:00
# get the directory of the current file, used later on in the file
2012-08-13 21:47:32 +04:00
get_filename_component ( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH )
2009-11-15 21:02:19 +03:00
2012-08-13 21:42:58 +04:00
2006-09-06 16:31:50 +04:00
###############################################
#
2012-08-13 21:42:58 +04:00
# configuration/system dependent settings
2006-09-06 16:31:50 +04:00
#
###############################################
2012-08-13 21:47:32 +04:00
include ( "${_qt4_current_dir}/Qt4ConfigDependentSettings.cmake" )
2008-03-17 21:53:02 +03:00
2005-09-12 17:00:55 +04:00
2011-01-01 21:45:05 +03:00
#######################################
#
# Check the plugins of Qt
#
#######################################
2012-08-13 21:47:32 +04:00
set ( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers )
set ( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets )
2014-07-24 11:46:26 +04:00
set ( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer qnativewifibearer )
2012-08-13 21:47:32 +04:00
set ( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs )
set ( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows )
set ( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin )
set ( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb )
set ( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem )
set ( QT_ICONENGINES_PLUGINS qsvgicon )
2014-07-24 11:46:26 +04:00
set ( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff qtga )
2012-08-13 21:47:32 +04:00
set ( QT_INPUTMETHODS_PLUGINS qimsw_multi )
set ( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler )
if ( APPLE )
set ( QT_PHONON_BACKEND_PLUGINS phonon_qt7 )
elseif ( WIN32 )
set ( QT_PHONON_BACKEND_PLUGINS phonon_ds9 )
endif ( )
set ( QT_SCRIPT_PLUGINS qtscriptdbus )
set ( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds )
set ( QT_PHONON_PLUGINS ${ QT_PHONON_BACKEND_PLUGINS } )
set ( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets )
set ( QT_QTCORE_PLUGINS ${ QT_BEARER_PLUGINS } ${ QT_CODECS_PLUGINS } )
2014-07-24 11:46:26 +04:00
set ( QT_QTGUI_PLUGINS qtaccessiblewidgets ${ QT_IMAGEFORMATS_PLUGINS } ${ QT_DECORATIONS_PLUGINS } ${ QT_GRAPHICSDRIVERS_PLUGINS } ${ QT_GRAPHICSSYSTEMS_PLUGINS } ${ QT_INPUTMETHODS_PLUGINS } ${ QT_MOUSEDRIVERS_PLUGINS } )
2012-08-13 21:47:32 +04:00
set ( QT_QTSCRIPT_PLUGINS ${ QT_SCRIPT_PLUGINS } )
set ( QT_QTSQL_PLUGINS ${ QT_SQLDRIVERS_PLUGINS } )
set ( QT_QTSVG_PLUGINS qsvg qsvgicon )
if ( QT_QMAKE_CHANGED )
foreach ( QT_PLUGIN_TYPE ${ QT_PLUGIN_TYPES } )
string ( TOUPPER ${ QT_PLUGIN_TYPE } _upper_qt_plugin_type )
set ( QT_ ${ _upper_qt_plugin_type } _PLUGINS_DIR ${ QT_PLUGINS_DIR } / ${ QT_PLUGIN_TYPE } )
foreach ( QT_PLUGIN ${ QT_${_upper_qt_plugin_type } _PLUGINS} )
string ( TOUPPER ${ QT_PLUGIN } _upper_qt_plugin )
unset ( QT_ ${ _upper_qt_plugin } _LIBRARY_RELEASE CACHE )
unset ( QT_ ${ _upper_qt_plugin } _LIBRARY_DEBUG CACHE )
unset ( QT_ ${ _upper_qt_plugin } _LIBRARY CACHE )
unset ( QT_ ${ _upper_qt_plugin } _PLUGIN_RELEASE CACHE )
unset ( QT_ ${ _upper_qt_plugin } _PLUGIN_DEBUG CACHE )
unset ( QT_ ${ _upper_qt_plugin } _PLUGIN CACHE )
2012-08-13 21:50:14 +04:00
endforeach ( )
endforeach ( )
endif ( )
2011-01-01 21:45:05 +03:00
# find_library works better than find_file but we need to set prefixes to only match plugins
2012-08-13 21:47:32 +04:00
foreach ( QT_PLUGIN_TYPE ${ QT_PLUGIN_TYPES } )
string ( TOUPPER ${ QT_PLUGIN_TYPE } _upper_qt_plugin_type )
set ( QT_ ${ _upper_qt_plugin_type } _PLUGINS_DIR ${ QT_PLUGINS_DIR } / ${ QT_PLUGIN_TYPE } )
foreach ( QT_PLUGIN ${ QT_${_upper_qt_plugin_type } _PLUGINS} )
string ( TOUPPER ${ QT_PLUGIN } _upper_qt_plugin )
if ( QT_IS_STATIC )
find_library ( QT_ ${ _upper_qt_plugin } _LIBRARY_RELEASE
2011-01-01 21:45:05 +03:00
N A M E S $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } 4
2011-03-11 00:17:13 +03:00
P A T H S $ { Q T _ $ { _ u p p e r _ q t _ p l u g i n _ t y p e } _ P L U G I N S _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2011-01-01 21:45:05 +03:00
)
2012-08-13 21:47:32 +04:00
find_library ( QT_ ${ _upper_qt_plugin } _LIBRARY_DEBUG
2011-01-01 21:45:05 +03:00
N A M E S $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } _ d e b u g $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } d $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } d 4
2011-03-11 00:17:13 +03:00
P A T H S $ { Q T _ $ { _ u p p e r _ q t _ p l u g i n _ t y p e } _ P L U G I N S _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2011-01-01 21:45:05 +03:00
)
_QT4_ADJUST_LIB_VARS ( ${ QT_PLUGIN } )
2012-08-13 21:50:14 +04:00
else ( )
2011-01-01 21:45:05 +03:00
# find_library works easier/better than find_file but we need to set suffixes to only match plugins
2012-08-13 21:47:32 +04:00
set ( CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${ CMAKE_FIND_LIBRARY_SUFFIXES } )
set ( CMAKE_FIND_LIBRARY_SUFFIXES ${ CMAKE_SHARED_MODULE_SUFFIX } ${ CMAKE_SHARED_LIBRARY_SUFFIX } )
find_library ( QT_ ${ _upper_qt_plugin } _PLUGIN_RELEASE
2011-01-01 21:45:05 +03:00
N A M E S $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } 4
2011-03-11 00:17:13 +03:00
P A T H S $ { Q T _ $ { _ u p p e r _ q t _ p l u g i n _ t y p e } _ P L U G I N S _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2011-01-01 21:45:05 +03:00
)
2012-08-13 21:47:32 +04:00
find_library ( QT_ ${ _upper_qt_plugin } _PLUGIN_DEBUG
2011-01-01 21:45:05 +03:00
N A M E S $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } _ d e b u g $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } d $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } d 4
2011-03-11 00:17:13 +03:00
P A T H S $ { Q T _ $ { _ u p p e r _ q t _ p l u g i n _ t y p e } _ P L U G I N S _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
2011-01-01 21:45:05 +03:00
)
2012-08-13 21:47:32 +04:00
mark_as_advanced ( QT_ ${ _upper_qt_plugin } _PLUGIN_RELEASE QT_ ${ _upper_qt_plugin } _PLUGIN_DEBUG )
set ( CMAKE_FIND_LIBRARY_SUFFIXES ${ CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT } )
2012-08-13 21:50:14 +04:00
endif ( )
endforeach ( )
endforeach ( )
2011-01-01 21:45:05 +03:00
######################################
#
# Macros for building Qt files
#
######################################
2012-08-13 21:47:32 +04:00
include ( "${_qt4_current_dir}/Qt4Macros.cmake" )
2011-01-01 21:45:05 +03:00
2012-08-13 21:50:14 +04:00
endif ( )
2011-01-01 21:45:05 +03:00
2011-01-15 07:26:19 +03:00
#support old QT_MIN_VERSION if set, but not if version is supplied by find_package()
2012-08-13 21:47:32 +04:00
if ( NOT Qt4_FIND_VERSION AND QT_MIN_VERSION )
set ( Qt4_FIND_VERSION ${ QT_MIN_VERSION } )
2012-08-13 21:50:14 +04:00
endif ( )
2011-01-15 07:26:19 +03:00
2012-08-13 21:47:32 +04:00
if ( Qt4_FIND_COMPONENTS )
2011-01-15 07:26:19 +03:00
# if components specified in find_package(), make sure each of those pieces were found
2012-08-13 21:47:32 +04:00
set ( _QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR )
foreach ( component ${ Qt4_FIND_COMPONENTS } )
string ( TOUPPER ${ component } _COMPONENT )
2011-02-04 02:37:04 +03:00
if ( ${ _COMPONENT } STREQUAL "QTMAIN" )
2012-08-13 21:47:32 +04:00
if ( Q_WS_WIN )
set ( _QT4_FOUND_REQUIRED_VARS ${ _QT4_FOUND_REQUIRED_VARS } QT_ ${ _COMPONENT } _LIBRARY )
2012-08-13 21:50:14 +04:00
endif ( )
else ( )
2012-08-13 21:47:32 +04:00
set ( _QT4_FOUND_REQUIRED_VARS ${ _QT4_FOUND_REQUIRED_VARS } QT_ ${ _COMPONENT } _INCLUDE_DIR QT_ ${ _COMPONENT } _LIBRARY )
2012-08-13 21:50:14 +04:00
endif ( )
endforeach ( )
2011-01-15 07:26:19 +03:00
if ( Qt4_FIND_COMPONENTS MATCHES QtGui )
2012-08-13 21:47:32 +04:00
set ( _QT4_FOUND_REQUIRED_VARS ${ _QT4_FOUND_REQUIRED_VARS } QT_UIC_EXECUTABLE )
2012-08-13 21:50:14 +04:00
endif ( )
2011-01-15 07:26:19 +03:00
2012-08-13 21:50:14 +04:00
else ( )
2011-01-15 07:26:19 +03:00
# if no components specified, we'll make a default set of required variables to say Qt is found
2012-08-13 21:47:32 +04:00
set ( _QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR
2011-01-15 07:26:19 +03:00
Q T _ L I B R A R Y _ D I R Q T _ Q T C O R E _ L I B R A R Y )
2012-08-13 21:50:14 +04:00
endif ( )
2011-01-15 07:26:19 +03:00
2013-03-05 20:32:55 +04:00
if ( NOT QT_VERSION_MAJOR EQUAL 4 )
2012-08-13 21:47:32 +04:00
set ( VERSION_MSG "Found unsuitable Qt version \" ${ QTVERSION } \" from ${ QT_QMAKE_EXECUTABLE } " )
set ( QT4_FOUND FALSE )
if ( Qt4_FIND_REQUIRED )
message ( FATAL_ERROR "${VERSION_MSG}, this code requires Qt 4.x" )
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
if ( NOT Qt4_FIND_QUIETLY )
message ( STATUS "${VERSION_MSG}" )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
2012-05-03 18:46:50 +04:00
else ( )
2013-03-16 21:42:14 +04:00
FIND_PACKAGE_HANDLE_STANDARD_ARGS ( Qt4 FOUND_VAR Qt4_FOUND
2012-05-03 18:46:50 +04:00
R E Q U I R E D _ V A R S $ { _ Q T 4 _ F O U N D _ R E Q U I R E D _ V A R S }
V E R S I O N _ V A R Q T V E R S I O N
)
endif ( )
2011-01-15 07:26:19 +03:00
#######################################
#
# compatibility settings
#
#######################################
# Backwards compatibility for CMake1.4 and 1.2
2012-08-13 21:47:32 +04:00
set ( QT_MOC_EXE ${ QT_MOC_EXECUTABLE } )
set ( QT_UIC_EXE ${ QT_UIC_EXECUTABLE } )
set ( QT_QT_LIBRARY "" )
2013-03-16 21:42:14 +04:00
set ( QT4_FOUND ${ Qt4_FOUND } )
set ( QT_FOUND ${ Qt4_FOUND } )
2006-04-27 23:07:23 +04:00