2 # Sets up C and C++ to use Qt 4. It is assumed that FindQt.cmake
3 # has already been loaded. See FindQt.cmake for information on
4 # how to load Qt 4 into your CMake project.
6 #=============================================================================
7 # Copyright 2005-2009 Kitware, Inc.
9 # Distributed under the OSI-approved BSD License (the "License");
10 # see accompanying file Copyright.txt for details.
12 # This software is distributed WITHOUT ANY WARRANTY; without even the
13 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 # See the License for more information.
15 #=============================================================================
16 # (To distribute this file outside of CMake, substitute the full
17 # License text for the above reference.)
19 add_definitions(${QT_DEFINITIONS})
20 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG)
21 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
22 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
23 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)
24 if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
25 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG)
28 include_directories(${QT_INCLUDE_DIR})
31 set(QT_LIBRARIES_PLUGINS "")
35 set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
45 if(QT_DONT_USE_QTCORE)
51 if (QT_USE_QT3SUPPORT)
52 add_definitions(-DQT3_SUPPORT)
55 # list dependent modules, so dependent libraries are added
56 set(QT_QT3SUPPORT_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE)
57 set(QT_QTSVG_MODULE_DEPENDS QTGUI QTXML QTCORE)
58 set(QT_QTUITOOLS_MODULE_DEPENDS QTGUI QTXML QTCORE)
59 set(QT_QTHELP_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE)
61 set(QT_PHONON_MODULE_DEPENDS QTGUI QTDBUS QTCORE)
63 set(QT_PHONON_MODULE_DEPENDS QTGUI QTCORE)
65 set(QT_QTDBUS_MODULE_DEPENDS QTXML QTCORE)
66 set(QT_QTXMLPATTERNS_MODULE_DEPENDS QTNETWORK QTCORE)
67 set(QT_QAXCONTAINER_MODULE_DEPENDS QTGUI QTCORE)
68 set(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE)
69 set(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE)
70 set(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE)
71 set(QT_QTDECLARATIVE_MODULE_DEPENDS QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTGUI QTCORE)
72 set(QT_QTMULTIMEDIA_MODULE_DEPENDS QTGUI QTCORE)
73 set(QT_QTOPENGL_MODULE_DEPENDS QTGUI QTCORE)
74 set(QT_QTSCRIPT_MODULE_DEPENDS QTCORE)
75 set(QT_QTGUI_MODULE_DEPENDS QTCORE)
76 set(QT_QTTEST_MODULE_DEPENDS QTCORE)
77 set(QT_QTXML_MODULE_DEPENDS QTCORE)
78 set(QT_QTSQL_MODULE_DEPENDS QTCORE)
79 set(QT_QTNETWORK_MODULE_DEPENDS QTCORE)
81 # Qt modules (in order of dependence)
82 foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
83 QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP
84 QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTXMLPATTERNS QTGUI QTTEST
85 QTDBUS QTXML QTSQL QTNETWORK QTCORE)
87 if (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
88 if (QT_${module}_FOUND)
90 string(REPLACE "QT" "" qt_module_def "${module}")
91 add_definitions(-DQT_${qt_module_def}_LIB)
92 include_directories(${QT_${module}_INCLUDE_DIR})
94 set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
95 set(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})
97 set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})
99 foreach(depend_module ${QT_${module}_MODULE_DEPENDS})
100 set(QT_USE_${depend_module}_DEPENDS 1)
103 message("Qt ${module} library not found.")