FindQt4.cmake 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116
  1. # - Find QT 4
  2. # This module can be used to find Qt4.
  3. # The most important issue is that the Qt4 qmake is available via the system path.
  4. # This qmake is then used to detect basically everything else.
  5. # This module defines a number of key variables and macros.
  6. # The variable QT_USE_FILE is set which is the path to a CMake file that can be included
  7. # to compile Qt 4 applications and libraries. It sets up the compilation
  8. # environment for include directories, preprocessor defines and populates a
  9. # QT_LIBRARIES variable.
  10. #
  11. # Typical usage could be something like:
  12. # find_package(Qt4 4.4.3 COMPONENTS QtCore QtGui QtXml REQUIRED )
  13. # include(${QT_USE_FILE})
  14. # add_executable(myexe main.cpp)
  15. # target_link_libraries(myexe ${QT_LIBRARIES})
  16. #
  17. # The minimum required version can be specified using the standard find_package()-syntax
  18. # (see example above).
  19. # For compatibility with older versions of FindQt4.cmake it is also possible to
  20. # set the variable QT_MIN_VERSION to the minimum required version of Qt4 before the
  21. # find_package(Qt4) command.
  22. # If both are used, the version used in the find_package() command overrides the
  23. # one from QT_MIN_VERSION.
  24. #
  25. # When using the components argument, QT_USE_QT* variables are automatically set
  26. # for the QT_USE_FILE to pick up. If one wishes to manually set them, the
  27. # available ones to set include:
  28. # QT_DONT_USE_QTCORE
  29. # QT_DONT_USE_QTGUI
  30. # QT_USE_QT3SUPPORT
  31. # QT_USE_QTASSISTANT
  32. # QT_USE_QAXCONTAINER
  33. # QT_USE_QAXSERVER
  34. # QT_USE_QTDESIGNER
  35. # QT_USE_QTMOTIF
  36. # QT_USE_QTMAIN
  37. # QT_USE_QTMULTIMEDIA
  38. # QT_USE_QTNETWORK
  39. # QT_USE_QTNSPLUGIN
  40. # QT_USE_QTOPENGL
  41. # QT_USE_QTSQL
  42. # QT_USE_QTXML
  43. # QT_USE_QTSVG
  44. # QT_USE_QTTEST
  45. # QT_USE_QTUITOOLS
  46. # QT_USE_QTDBUS
  47. # QT_USE_QTSCRIPT
  48. # QT_USE_QTASSISTANTCLIENT
  49. # QT_USE_QTHELP
  50. # QT_USE_QTWEBKIT
  51. # QT_USE_QTXMLPATTERNS
  52. # QT_USE_PHONON
  53. # QT_USE_QTSCRIPTTOOLS
  54. #
  55. # There are also some files that need processing by some Qt tools such as moc
  56. # and uic. Listed below are macros that may be used to process those files.
  57. #
  58. # macro QT4_WRAP_CPP(outfiles inputfile ... OPTIONS ...)
  59. # create moc code from a list of files containing Qt class with
  60. # the Q_OBJECT declaration. Per-direcotry preprocessor definitions
  61. # are also added. Options may be given to moc, such as those found
  62. # when executing "moc -help".
  63. #
  64. # macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...)
  65. # create code from a list of Qt designer ui files.
  66. # Options may be given to uic, such as those found
  67. # when executing "uic -help"
  68. #
  69. # macro QT4_ADD_RESOURCES(outfiles inputfile ... OPTIONS ...)
  70. # create code from a list of Qt resource files.
  71. # Options may be given to rcc, such as those found
  72. # when executing "rcc -help"
  73. #
  74. # macro QT4_GENERATE_MOC(inputfile outputfile )
  75. # creates a rule to run moc on infile and create outfile.
  76. # Use this if for some reason QT4_WRAP_CPP() isn't appropriate, e.g.
  77. # because you need a custom filename for the moc file or something similar.
  78. #
  79. # macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... )
  80. # This macro is still experimental.
  81. # It can be used to have moc automatically handled.
  82. # So if you have the files foo.h and foo.cpp, and in foo.h a
  83. # a class uses the Q_OBJECT macro, moc has to run on it. If you don't
  84. # want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert
  85. # #include "foo.moc"
  86. # in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the
  87. # scan all listed files at cmake-time for such included moc files and if it finds
  88. # them cause a rule to be generated to run moc at build time on the
  89. # accompanying header file foo.h.
  90. # If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro.
  91. #
  92. # macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename)
  93. # create a the interface header and implementation files with the
  94. # given basename from the given interface xml file and add it to
  95. # the list of sources
  96. #
  97. # macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... )
  98. # create the interface header and implementation files
  99. # for all listed interface xml files
  100. # the name will be automatically determined from the name of the xml file
  101. #
  102. # macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] [classname])
  103. # create a dbus adaptor (header and implementation file) from the xml file
  104. # describing the interface, and add it to the list of sources. The adaptor
  105. # forwards the calls to a parent class, defined in parentheader and named
  106. # parentclassname. The name of the generated files will be
  107. # <basename>adaptor.{cpp,h} where basename defaults to the basename of the xml file.
  108. # If <classname> is provided, then it will be used as the classname of the
  109. # adaptor itself.
  110. #
  111. # macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...)
  112. # generate the xml interface file from the given header.
  113. # If the optional argument interfacename is omitted, the name of the
  114. # interface file is constructed from the basename of the header with
  115. # the suffix .xml appended.
  116. # Options may be given to qdbuscpp2xml, such as those found when executing "qdbuscpp2xml --help"
  117. #
  118. # macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ...
  119. # ts_files ... OPTIONS ...)
  120. # out: qm_files
  121. # in: directories sources ts_files
  122. # options: flags to pass to lupdate, such as -extensions to specify
  123. # extensions for a directory scan.
  124. # generates commands to create .ts (vie lupdate) and .qm
  125. # (via lrelease) - files from directories and/or sources. The ts files are
  126. # created and/or updated in the source tree (unless given with full paths).
  127. # The qm files are generated in the build tree.
  128. # Updating the translations can be done by adding the qm_files
  129. # to the source list of your library/executable, so they are
  130. # always updated, or by adding a custom target to control when
  131. # they get updated/generated.
  132. #
  133. # macro QT4_ADD_TRANSLATION( qm_files ts_files ... )
  134. # out: qm_files
  135. # in: ts_files
  136. # generates commands to create .qm from .ts - files. The generated
  137. # filenames can be found in qm_files. The ts_files
  138. # must exists and are not updated in any way.
  139. #
  140. #
  141. # Below is a detailed list of variables that FindQt4.cmake sets.
  142. # QT_FOUND If false, don't try to use Qt.
  143. # QT4_FOUND If false, don't try to use Qt 4.
  144. #
  145. # QT_VERSION_MAJOR The major version of Qt found.
  146. # QT_VERSION_MINOR The minor version of Qt found.
  147. # QT_VERSION_PATCH The patch version of Qt found.
  148. #
  149. # QT_EDITION Set to the edition of Qt (i.e. DesktopLight)
  150. # QT_EDITION_DESKTOPLIGHT True if QT_EDITION == DesktopLight
  151. # QT_QTCORE_FOUND True if QtCore was found.
  152. # QT_QTGUI_FOUND True if QtGui was found.
  153. # QT_QT3SUPPORT_FOUND True if Qt3Support was found.
  154. # QT_QTASSISTANT_FOUND True if QtAssistant was found.
  155. # QT_QTASSISTANTCLIENT_FOUND True if QtAssistantClient was found.
  156. # QT_QAXCONTAINER_FOUND True if QAxContainer was found (Windows only).
  157. # QT_QAXSERVER_FOUND True if QAxServer was found (Windows only).
  158. # QT_QTDBUS_FOUND True if QtDBus was found.
  159. # QT_QTDESIGNER_FOUND True if QtDesigner was found.
  160. # QT_QTDESIGNERCOMPONENTS True if QtDesignerComponents was found.
  161. # QT_QTHELP_FOUND True if QtHelp was found.
  162. # QT_QTMOTIF_FOUND True if QtMotif was found.
  163. # QT_QTMULTIMEDIA_FOUND True if QtMultimedia was found (since Qt 4.6.0).
  164. # QT_QTNETWORK_FOUND True if QtNetwork was found.
  165. # QT_QTNSPLUGIN_FOUND True if QtNsPlugin was found.
  166. # QT_QTOPENGL_FOUND True if QtOpenGL was found.
  167. # QT_QTSQL_FOUND True if QtSql was found.
  168. # QT_QTSVG_FOUND True if QtSvg was found.
  169. # QT_QTSCRIPT_FOUND True if QtScript was found.
  170. # QT_QTSCRIPTTOOLS_FOUND True if QtScriptTools was found.
  171. # QT_QTTEST_FOUND True if QtTest was found.
  172. # QT_QTUITOOLS_FOUND True if QtUiTools was found.
  173. # QT_QTWEBKIT_FOUND True if QtWebKit was found.
  174. # QT_QTXML_FOUND True if QtXml was found.
  175. # QT_QTXMLPATTERNS_FOUND True if QtXmlPatterns was found.
  176. # QT_PHONON_FOUND True if phonon was found.
  177. #
  178. # QT_MAC_USE_COCOA For Mac OS X, its whether Cocoa or Carbon is used.
  179. # In general, this should not be used, but its useful
  180. # when having platform specific code.
  181. #
  182. # QT_DEFINITIONS Definitions to use when compiling code that uses Qt.
  183. # You do not need to use this if you include QT_USE_FILE.
  184. # The QT_USE_FILE will also define QT_DEBUG and QT_NO_DEBUG
  185. # to fit your current build type. Those are not contained
  186. # in QT_DEFINITIONS.
  187. #
  188. # QT_INCLUDES List of paths to all include directories of
  189. # Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR are
  190. # always in this variable even if NOTFOUND,
  191. # all other INCLUDE_DIRS are
  192. # only added if they are found.
  193. # You do not need to use this if you include QT_USE_FILE.
  194. #
  195. #
  196. # Include directories for the Qt modules are listed here.
  197. # You do not need to use these variables if you include QT_USE_FILE.
  198. #
  199. # QT_INCLUDE_DIR Path to "include" of Qt4
  200. # QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support"
  201. # QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant"
  202. # QT_QTASSISTANTCLIENT_INCLUDE_DIR Path to "include/QtAssistant"
  203. # QT_QAXCONTAINER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only)
  204. # QT_QAXSERVER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only)
  205. # QT_QTCORE_INCLUDE_DIR Path to "include/QtCore"
  206. # QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus"
  207. # QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner"
  208. # QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR Path to "include/QtDesigner"
  209. # QT_QTGUI_INCLUDE_DIR Path to "include/QtGui"
  210. # QT_QTHELP_INCLUDE_DIR Path to "include/QtHelp"
  211. # QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif"
  212. # QT_QTMULTIMEDIA_INCLUDE_DIR Path to "include/QtMultimedia"
  213. # QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork"
  214. # QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin"
  215. # QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL"
  216. # QT_QTSCRIPT_INCLUDE_DIR Path to "include/QtScript"
  217. # QT_QTSQL_INCLUDE_DIR Path to "include/QtSql"
  218. # QT_QTSVG_INCLUDE_DIR Path to "include/QtSvg"
  219. # QT_QTTEST_INCLUDE_DIR Path to "include/QtTest"
  220. # QT_QTWEBKIT_INCLUDE_DIR Path to "include/QtWebKit"
  221. # QT_QTXML_INCLUDE_DIR Path to "include/QtXml"
  222. # QT_QTXMLPATTERNS_INCLUDE_DIR Path to "include/QtXmlPatterns"
  223. # QT_PHONON_INCLUDE_DIR Path to "include/phonon"
  224. # QT_QTSCRIPTTOOLS_INCLUDE_DIR Path to "include/QtScriptTools"
  225. #
  226. # QT_BINARY_DIR Path to "bin" of Qt4
  227. # QT_LIBRARY_DIR Path to "lib" of Qt4
  228. # QT_PLUGINS_DIR Path to "plugins" for Qt4
  229. # QT_TRANSLATIONS_DIR Path to "translations" of Qt4
  230. # QT_DOC_DIR Path to "doc" of Qt4
  231. # QT_MKSPECS_DIR Path to "mkspecs" of Qt4
  232. #
  233. #
  234. # The Qt toolkit may contain both debug and release libraries.
  235. # In that case, the following library variables will contain both.
  236. # You do not need to use these variables if you include QT_USE_FILE,
  237. # and use QT_LIBRARIES.
  238. #
  239. # QT_QT3SUPPORT_LIBRARY The Qt3Support library
  240. # QT_QTASSISTANT_LIBRARY The QtAssistant library
  241. # QT_QTASSISTANTCLIENT_LIBRARY The QtAssistantClient library
  242. # QT_QAXCONTAINER_LIBRARY The QAxContainer library (Windows only)
  243. # QT_QAXSERVER_LIBRARY The QAxServer library (Windows only)
  244. # QT_QTCORE_LIBRARY The QtCore library
  245. # QT_QTDBUS_LIBRARY The QtDBus library
  246. # QT_QTDESIGNER_LIBRARY The QtDesigner library
  247. # QT_QTDESIGNERCOMPONENTS_LIBRARY The QtDesignerComponents library
  248. # QT_QTGUI_LIBRARY The QtGui library
  249. # QT_QTHELP_LIBRARY The QtHelp library
  250. # QT_QTMOTIF_LIBRARY The QtMotif library
  251. # QT_QTMULTIMEDIA_LIBRARY The QtMultimedia library
  252. # QT_QTNETWORK_LIBRARY The QtNetwork library
  253. # QT_QTNSPLUGIN_LIBRARY The QtNsPLugin library
  254. # QT_QTOPENGL_LIBRARY The QtOpenGL library
  255. # QT_QTSCRIPT_LIBRARY The QtScript library
  256. # QT_QTSQL_LIBRARY The QtSql library
  257. # QT_QTSVG_LIBRARY The QtSvg library
  258. # QT_QTTEST_LIBRARY The QtTest library
  259. # QT_QTUITOOLS_LIBRARY The QtUiTools library
  260. # QT_QTWEBKIT_LIBRARY The QtWebKit library
  261. # QT_QTXML_LIBRARY The QtXml library
  262. # QT_QTXMLPATTERNS_LIBRARY The QtXmlPatterns library
  263. # QT_QTMAIN_LIBRARY The qtmain library for Windows
  264. # QT_PHONON_LIBRARY The phonon library
  265. # QT_QTSCRIPTTOOLS_LIBRARY The QtScriptTools library
  266. #
  267. # also defined, but NOT for general use are
  268. # QT_MOC_EXECUTABLE Where to find the moc tool.
  269. # QT_UIC_EXECUTABLE Where to find the uic tool.
  270. # QT_UIC3_EXECUTABLE Where to find the uic3 tool.
  271. # QT_RCC_EXECUTABLE Where to find the rcc tool
  272. # QT_DBUSCPP2XML_EXECUTABLE Where to find the qdbuscpp2xml tool.
  273. # QT_DBUSXML2CPP_EXECUTABLE Where to find the qdbusxml2cpp tool.
  274. # QT_LUPDATE_EXECUTABLE Where to find the lupdate tool.
  275. # QT_LRELEASE_EXECUTABLE Where to find the lrelease tool.
  276. # QT_QCOLLECTIONGENERATOR_EXECUTABLE Where to find the qcollectiongenerator tool.
  277. # QT_DESIGNER_EXECUTABLE Where to find the Qt designer tool.
  278. # QT_LINGUIST_EXECUTABLE Where to find the Qt linguist tool.
  279. #
  280. #
  281. # These are around for backwards compatibility
  282. # they will be set
  283. # QT_WRAP_CPP Set true if QT_MOC_EXECUTABLE is found
  284. # QT_WRAP_UI Set true if QT_UIC_EXECUTABLE is found
  285. #
  286. # These variables do _NOT_ have any effect anymore (compared to FindQt.cmake)
  287. # QT_MT_REQUIRED Qt4 is now always multithreaded
  288. #
  289. # These variables are set to "" Because Qt structure changed
  290. # (They make no sense in Qt4)
  291. # QT_QT_LIBRARY Qt-Library is now split
  292. #=============================================================================
  293. # Copyright 2005-2009 Kitware, Inc.
  294. #
  295. # Distributed under the OSI-approved BSD License (the "License");
  296. # see accompanying file Copyright.txt for details.
  297. #
  298. # This software is distributed WITHOUT ANY WARRANTY; without even the
  299. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  300. # See the License for more information.
  301. #=============================================================================
  302. # (To distributed this file outside of CMake, substitute the full
  303. # License text for the above reference.)
  304. # Use FIND_PACKAGE( Qt4 COMPONENTS ... ) to enable modules
  305. IF( Qt4_FIND_COMPONENTS )
  306. FOREACH( component ${Qt4_FIND_COMPONENTS} )
  307. STRING( TOUPPER ${component} _COMPONENT )
  308. SET( QT_USE_${_COMPONENT} 1 )
  309. ENDFOREACH( component )
  310. # To make sure we don't use QtCore or QtGui when not in COMPONENTS
  311. IF(NOT QT_USE_QTCORE)
  312. SET( QT_DONT_USE_QTCORE 1 )
  313. ENDIF(NOT QT_USE_QTCORE)
  314. IF(NOT QT_USE_QTGUI)
  315. SET( QT_DONT_USE_QTGUI 1 )
  316. ENDIF(NOT QT_USE_QTGUI)
  317. ENDIF( Qt4_FIND_COMPONENTS )
  318. # If Qt3 has already been found, fail.
  319. IF(QT_QT_LIBRARY)
  320. IF(Qt4_FIND_REQUIRED)
  321. MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.")
  322. ELSE(Qt4_FIND_REQUIRED)
  323. IF(NOT Qt4_FIND_QUIETLY)
  324. MESSAGE( STATUS "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.")
  325. ENDIF(NOT Qt4_FIND_QUIETLY)
  326. RETURN()
  327. ENDIF(Qt4_FIND_REQUIRED)
  328. ENDIF(QT_QT_LIBRARY)
  329. INCLUDE(CheckSymbolExists)
  330. INCLUDE(MacroAddFileDependencies)
  331. SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
  332. SET( QT_DEFINITIONS "")
  333. SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
  334. # macro for asking qmake to process pro files
  335. MACRO(QT_QUERY_QMAKE outvar invar)
  336. IF(QT_QMAKE_EXECUTABLE)
  337. FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro
  338. "message(CMAKE_MESSAGE<$$${invar}>)")
  339. # Invoke qmake with the tmp.pro program to get the desired
  340. # information. Use the same variable for both stdout and stderr
  341. # to make sure we get the output on all platforms.
  342. EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE}
  343. WORKING_DIRECTORY
  344. ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake
  345. OUTPUT_VARIABLE _qmake_query_output
  346. RESULT_VARIABLE _qmake_result
  347. ERROR_VARIABLE _qmake_query_output )
  348. FILE(REMOVE_RECURSE
  349. "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake")
  350. IF(_qmake_result)
  351. MESSAGE(WARNING " querying qmake for ${invar}. qmake reported:\n${_qmake_query_output}")
  352. ELSE(_qmake_result)
  353. STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}")
  354. ENDIF(_qmake_result)
  355. ENDIF(QT_QMAKE_EXECUTABLE)
  356. ENDMACRO(QT_QUERY_QMAKE)
  357. GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
  358. # check for qmake
  359. # Debian uses qmake-qt4
  360. # macports' Qt uses qmake-mac
  361. FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac PATHS
  362. "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
  363. "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
  364. "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin"
  365. $ENV{QTDIR}/bin
  366. )
  367. IF (QT_QMAKE_EXECUTABLE)
  368. IF(QT_QMAKE_EXECUTABLE_LAST)
  369. STRING(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED)
  370. ENDIF(QT_QMAKE_EXECUTABLE_LAST)
  371. SET(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE)
  372. SET(QT4_QMAKE_FOUND FALSE)
  373. EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
  374. # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path
  375. IF("${QTVERSION}" MATCHES "Unknown")
  376. SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)
  377. FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS
  378. "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
  379. "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
  380. $ENV{QTDIR}/bin
  381. )
  382. IF(QT_QMAKE_EXECUTABLE)
  383. EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE}
  384. ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
  385. ENDIF(QT_QMAKE_EXECUTABLE)
  386. ENDIF("${QTVERSION}" MATCHES "Unknown")
  387. # check that we found the Qt4 qmake, Qt3 qmake output won't match here
  388. STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}")
  389. IF (qt_version_tmp)
  390. # we need at least version 4.0.0
  391. IF (NOT QT_MIN_VERSION)
  392. SET(QT_MIN_VERSION "4.0.0")
  393. ENDIF (NOT QT_MIN_VERSION)
  394. #now parse the parts of the user given version string into variables
  395. STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" req_qt_major_vers "${QT_MIN_VERSION}")
  396. IF (NOT req_qt_major_vers)
  397. MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", expected e.g. \"4.0.1\"")
  398. ENDIF (NOT req_qt_major_vers)
  399. # now parse the parts of the user given version string into variables
  400. STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT_MIN_VERSION}")
  401. STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}")
  402. STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}")
  403. # Suppport finding at least a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 )
  404. # This implementation is a hack to avoid duplicating code and make sure we stay
  405. # source-compatible with CMake 2.6.x
  406. IF( Qt4_FIND_VERSION )
  407. SET( QT_MIN_VERSION ${Qt4_FIND_VERSION} )
  408. SET( req_qt_major_vers ${Qt4_FIND_VERSION_MAJOR} )
  409. SET( req_qt_minor_vers ${Qt4_FIND_VERSION_MINOR} )
  410. SET( req_qt_patch_vers ${Qt4_FIND_VERSION_PATCH} )
  411. ENDIF( Qt4_FIND_VERSION )
  412. IF (NOT req_qt_major_vers EQUAL 4)
  413. MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", major version 4 is required, e.g. \"4.0.1\"")
  414. ENDIF (NOT req_qt_major_vers EQUAL 4)
  415. # and now the version string given by qmake
  416. STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}")
  417. STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}")
  418. STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}")
  419. # compute an overall version number which can be compared at once
  420. MATH(EXPR req_vers "${req_qt_major_vers}*10000 + ${req_qt_minor_vers}*100 + ${req_qt_patch_vers}")
  421. MATH(EXPR found_vers "${QT_VERSION_MAJOR}*10000 + ${QT_VERSION_MINOR}*100 + ${QT_VERSION_PATCH}")
  422. # Support finding *exactly* a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 EXACT )
  423. IF( Qt4_FIND_VERSION_EXACT )
  424. IF(found_vers EQUAL req_vers)
  425. SET( QT4_QMAKE_FOUND TRUE )
  426. ELSE(found_vers EQUAL req_vers)
  427. SET( QT4_QMAKE_FOUND FALSE )
  428. IF (found_vers LESS req_vers)
  429. SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE)
  430. ELSE (found_vers LESS req_vers)
  431. SET(QT4_INSTALLED_VERSION_TOO_NEW TRUE)
  432. ENDIF (found_vers LESS req_vers)
  433. ENDIF(found_vers EQUAL req_vers)
  434. ELSE( Qt4_FIND_VERSION_EXACT )
  435. IF (found_vers LESS req_vers)
  436. SET(QT4_QMAKE_FOUND FALSE)
  437. SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE)
  438. ELSE (found_vers LESS req_vers)
  439. SET(QT4_QMAKE_FOUND TRUE)
  440. ENDIF (found_vers LESS req_vers)
  441. ENDIF( Qt4_FIND_VERSION_EXACT )
  442. ENDIF (qt_version_tmp)
  443. ENDIF (QT_QMAKE_EXECUTABLE)
  444. IF (QT4_QMAKE_FOUND)
  445. # ask qmake for the library dir
  446. # Set QT_LIBRARY_DIR
  447. IF (NOT QT_LIBRARY_DIR OR QT_QMAKE_CHANGED)
  448. EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
  449. ARGS "-query QT_INSTALL_LIBS"
  450. OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP )
  451. # make sure we have / and not \ as qmake gives on windows
  452. FILE(TO_CMAKE_PATH "${QT_LIBRARY_DIR_TMP}" QT_LIBRARY_DIR_TMP)
  453. IF(EXISTS "${QT_LIBRARY_DIR_TMP}")
  454. SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir" FORCE)
  455. ELSE(EXISTS "${QT_LIBRARY_DIR_TMP}")
  456. MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}")
  457. MESSAGE("Warning: ${QT_LIBRARY_DIR_TMP} does NOT exist, Qt must NOT be installed correctly.")
  458. ENDIF(EXISTS "${QT_LIBRARY_DIR_TMP}")
  459. ENDIF(NOT QT_LIBRARY_DIR OR QT_QMAKE_CHANGED)
  460. IF (APPLE)
  461. IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
  462. SET(QT_USE_FRAMEWORKS ON
  463. CACHE BOOL "Set to ON if Qt build uses frameworks." FORCE)
  464. ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
  465. SET(QT_USE_FRAMEWORKS OFF
  466. CACHE BOOL "Set to ON if Qt build uses frameworks." FORCE)
  467. ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
  468. MARK_AS_ADVANCED(QT_USE_FRAMEWORKS)
  469. ENDIF (APPLE)
  470. # ask qmake for the binary dir
  471. IF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED)
  472. EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE}
  473. ARGS "-query QT_INSTALL_BINS"
  474. OUTPUT_VARIABLE qt_bins )
  475. # make sure we have / and not \ as qmake gives on windows
  476. FILE(TO_CMAKE_PATH "${qt_bins}" qt_bins)
  477. SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE)
  478. ENDIF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED)
  479. # ask qmake for the include dir
  480. IF (QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED)
  481. EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
  482. ARGS "-query QT_INSTALL_HEADERS"
  483. OUTPUT_VARIABLE qt_headers )
  484. # make sure we have / and not \ as qmake gives on windows
  485. FILE(TO_CMAKE_PATH "${qt_headers}" qt_headers)
  486. SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "" FORCE)
  487. ENDIF (QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED)
  488. # ask qmake for the documentation directory
  489. IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED)
  490. EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
  491. ARGS "-query QT_INSTALL_DOCS"
  492. OUTPUT_VARIABLE qt_doc_dir )
  493. # make sure we have / and not \ as qmake gives on windows
  494. FILE(TO_CMAKE_PATH "${qt_doc_dir}" qt_doc_dir)
  495. SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE)
  496. ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED)
  497. # ask qmake for the mkspecs directory
  498. IF (QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED)
  499. EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
  500. ARGS "-query QMAKE_MKSPECS"
  501. OUTPUT_VARIABLE qt_mkspecs_dirs )
  502. # do not replace : on windows as it might be a drive letter
  503. # and windows should already use ; as a separator
  504. IF(UNIX)
  505. STRING(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}")
  506. ENDIF(UNIX)
  507. SET(QT_MKSPECS_DIR NOTFOUND)
  508. FIND_PATH(QT_MKSPECS_DIR qconfig.pri PATHS ${qt_mkspecs_dirs}
  509. DOC "The location of the Qt mkspecs containing qconfig.pri"
  510. NO_DEFAULT_PATH )
  511. ENDIF (QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED)
  512. # ask qmake for the plugins directory
  513. IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED)
  514. EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
  515. ARGS "-query QT_INSTALL_PLUGINS"
  516. OUTPUT_VARIABLE qt_plugins_dir )
  517. # make sure we have / and not \ as qmake gives on windows
  518. FILE(TO_CMAKE_PATH "${qt_plugins_dir}" qt_plugins_dir)
  519. SET(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins" FORCE)
  520. ENDIF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED)
  521. # ask qmake for the translations directory
  522. IF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED)
  523. EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
  524. ARGS "-query QT_INSTALL_TRANSLATIONS"
  525. OUTPUT_VARIABLE qt_translations_dir )
  526. # make sure we have / and not \ as qmake gives on windows
  527. FILE(TO_CMAKE_PATH "${qt_translations_dir}" qt_translations_dir)
  528. SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE)
  529. ENDIF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED)
  530. # Make variables changeble to the advanced user
  531. MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR
  532. QT_PLUGINS_DIR QT_TRANSLATIONS_DIR)
  533. #############################################
  534. #
  535. # Find out what window system we're using
  536. #
  537. #############################################
  538. # Save required variable
  539. SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
  540. SET(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
  541. # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
  542. SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_HEADERS_DIR}")
  543. # On Mac OS X when Qt has framework support, also add the framework path
  544. IF( QT_USE_FRAMEWORKS )
  545. SET(CMAKE_REQUIRED_FLAGS "-F${QT_LIBRARY_DIR} ")
  546. ENDIF( QT_USE_FRAMEWORKS )
  547. # Check for Window system symbols (note: only one should end up being set)
  548. CHECK_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11)
  549. CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
  550. CHECK_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS)
  551. CHECK_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC)
  552. IF(Q_WS_MAC)
  553. IF(QT_QMAKE_CHANGED)
  554. UNSET(QT_MAC_USE_COCOA CACHE)
  555. ENDIF(QT_QMAKE_CHANGED)
  556. CHECK_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA)
  557. ENDIF(Q_WS_MAC)
  558. IF (QT_QTCOPY_REQUIRED)
  559. CHECK_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY)
  560. IF (NOT QT_IS_QTCOPY)
  561. MESSAGE(FATAL_ERROR "qt-copy is required, but hasn't been found")
  562. ENDIF (NOT QT_IS_QTCOPY)
  563. ENDIF (QT_QTCOPY_REQUIRED)
  564. # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
  565. SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
  566. SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
  567. #
  568. #############################################
  569. ########################################
  570. #
  571. # Setting the INCLUDE-Variables
  572. #
  573. ########################################
  574. SET(QT_MODULES QtCore QtGui Qt3Support QtSvg QtScript QtTest QtUiTools
  575. QtHelp QtWebKit QtXmlPatterns phonon QtNetwork QtMultimedia
  576. QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools)
  577. IF(Q_WS_X11)
  578. SET(QT_MODULES ${QT_MODULES} QtMotif)
  579. ENDIF(Q_WS_X11)
  580. IF(QT_QMAKE_CHANGED)
  581. FOREACH(QT_MODULE ${QT_MODULES})
  582. STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
  583. SET(QT_${_upper_qt_module}_INCLUDE_DIR NOTFOUND)
  584. SET(QT_${_upper_qt_module}_LIBRARY_RELEASE NOTFOUND)
  585. SET(QT_${_upper_qt_module}_LIBRARY_DEBUG NOTFOUND)
  586. ENDFOREACH(QT_MODULE)
  587. SET(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR NOTFOUND)
  588. SET(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NOTFOUND)
  589. SET(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NOTFOUND)
  590. SET(QT_QTASSISTANTCLIENT_INCLUDE_DIR NOTFOUND)
  591. SET(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NOTFOUND)
  592. SET(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NOTFOUND)
  593. SET(QT_QTASSISTANT_INCLUDE_DIR NOTFOUND)
  594. SET(QT_QTASSISTANT_LIBRARY_RELEASE NOTFOUND)
  595. SET(QT_QTASSISTANT_LIBRARY_DEBUG NOTFOUND)
  596. SET(QT_QTCLUCENE_LIBRARY_RELEASE NOTFOUND)
  597. SET(QT_QTCLUCENE_LIBRARY_DEBUG NOTFOUND)
  598. SET(QT_QAXCONTAINER_INCLUDE_DIR NOTFOUND)
  599. SET(QT_QAXCONTAINER_LIBRARY_RELEASE NOTFOUND)
  600. SET(QT_QAXCONTAINER_LIBRARY_DEBUG NOTFOUND)
  601. SET(QT_QAXSERVER_INCLUDE_DIR NOTFOUND)
  602. SET(QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND)
  603. SET(QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND)
  604. IF(WIN32)
  605. SET(QT_QTMAIN_LIBRARY_DEBUG NOTFOUND)
  606. SET(QT_QTMAIN_LIBRARY_RELEASE NOTFOUND)
  607. ENDIF(WIN32)
  608. ENDIF(QT_QMAKE_CHANGED)
  609. FOREACH(QT_MODULE ${QT_MODULES})
  610. STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
  611. FIND_PATH(QT_${_upper_qt_module}_INCLUDE_DIR ${QT_MODULE}
  612. PATHS
  613. ${QT_HEADERS_DIR}/${QT_MODULE}
  614. ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers
  615. NO_DEFAULT_PATH
  616. )
  617. ENDFOREACH(QT_MODULE)
  618. IF(WIN32)
  619. SET(QT_MODULES ${QT_MODULES} QAxContainer QAxServer)
  620. # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR
  621. FIND_PATH(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt
  622. PATHS
  623. ${QT_HEADERS_DIR}/ActiveQt
  624. NO_DEFAULT_PATH
  625. )
  626. FIND_PATH(QT_QAXSERVER_INCLUDE_DIR ActiveQt
  627. PATHS
  628. ${QT_HEADERS_DIR}/ActiveQt
  629. NO_DEFAULT_PATH
  630. )
  631. ENDIF(WIN32)
  632. # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR
  633. FIND_PATH(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents
  634. PATHS
  635. ${QT_HEADERS_DIR}/QtDesigner
  636. ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers
  637. NO_DEFAULT_PATH
  638. )
  639. # Set QT_QTASSISTANT_INCLUDE_DIR
  640. FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QtAssistant
  641. PATHS
  642. ${QT_HEADERS_DIR}/QtAssistant
  643. ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers
  644. NO_DEFAULT_PATH
  645. )
  646. # Set QT_QTASSISTANTCLIENT_INCLUDE_DIR
  647. FIND_PATH(QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient
  648. PATHS
  649. ${QT_HEADERS_DIR}/QtAssistant
  650. ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers
  651. NO_DEFAULT_PATH
  652. )
  653. # Set QT_INCLUDE_DIR by removine "/QtCore" in the string ${QT_QTCORE_INCLUDE_DIR}
  654. IF( QT_QTCORE_INCLUDE_DIR )
  655. IF (QT_USE_FRAMEWORKS)
  656. SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR})
  657. ELSE (QT_USE_FRAMEWORKS)
  658. STRING( REGEX REPLACE "/QtCore$" "" qt4_include_dir ${QT_QTCORE_INCLUDE_DIR})
  659. SET( QT_INCLUDE_DIR ${qt4_include_dir})
  660. ENDIF (QT_USE_FRAMEWORKS)
  661. ENDIF( QT_QTCORE_INCLUDE_DIR )
  662. IF( NOT QT_INCLUDE_DIR)
  663. IF(Qt4_FIND_REQUIRED)
  664. MESSAGE( FATAL_ERROR "Could NOT find QtCore header")
  665. ENDIF(Qt4_FIND_REQUIRED)
  666. ENDIF( NOT QT_INCLUDE_DIR)
  667. # Make variables changeble to the advanced user
  668. MARK_AS_ADVANCED( QT_INCLUDE_DIR )
  669. # Set QT_INCLUDES
  670. SET( QT_INCLUDES ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} )
  671. #######################################
  672. #
  673. # Qt configuration
  674. #
  675. #######################################
  676. IF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
  677. FILE(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents)
  678. STRING(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}")
  679. STRING(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}")
  680. STRING(REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}")
  681. STRING(REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}")
  682. STRING(REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}")
  683. ENDIF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
  684. IF("${QT_EDITION}" MATCHES "DesktopLight")
  685. SET(QT_EDITION_DESKTOPLIGHT 1)
  686. ENDIF("${QT_EDITION}" MATCHES "DesktopLight")
  687. ########################################
  688. #
  689. # Setting the LIBRARY-Variables
  690. #
  691. ########################################
  692. # find the libraries
  693. FOREACH(QT_MODULE ${QT_MODULES})
  694. STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
  695. FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_RELEASE
  696. NAMES ${QT_MODULE}${QT_LIBINFIX} ${QT_MODULE}${QT_LIBINFIX}4
  697. PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH
  698. )
  699. FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_DEBUG
  700. NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4
  701. PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH
  702. )
  703. ENDFOREACH(QT_MODULE)
  704. # QtUiTools not with other frameworks with binary installation (in /usr/lib)
  705. IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE)
  706. FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR})
  707. ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE)
  708. IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE )
  709. # try dropping a hint if trying to use Visual Studio with Qt built by mingw
  710. IF(QT_LIBRARY_DIR AND MSVC)
  711. IF(EXISTS ${QT_LIBRARY_DIR}/libqtmain.a)
  712. MESSAGE( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw")
  713. ENDIF(EXISTS ${QT_LIBRARY_DIR}/libqtmain.a)
  714. ENDIF(QT_LIBRARY_DIR AND MSVC)
  715. IF(Qt4_FIND_REQUIRED)
  716. MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
  717. ENDIF(Qt4_FIND_REQUIRED)
  718. ENDIF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE )
  719. # Set QT_QTDESIGNERCOMPONENTS_LIBRARY
  720. FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents${QT_LIBINFIX} QtDesignerComponents${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
  721. 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)
  722. # Set QT_QTMAIN_LIBRARY
  723. IF(WIN32)
  724. FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR}
  725. NO_DEFAULT_PATH)
  726. FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR}
  727. NO_DEFAULT_PATH)
  728. ENDIF(WIN32)
  729. # Set QT_QTASSISTANTCLIENT_LIBRARY
  730. FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
  731. 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)
  732. # Set QT_QTASSISTANT_LIBRARY
  733. 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)
  734. 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)
  735. # Set QT_QTHELP_LIBRARY
  736. FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
  737. 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)
  738. # QtCLucene not with other frameworks with binary installation (in /usr/lib)
  739. IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE)
  740. FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR})
  741. ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE)
  742. ############################################
  743. #
  744. # Check the existence of the libraries.
  745. #
  746. ############################################
  747. MACRO (_QT4_ADJUST_LIB_VARS basename)
  748. IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
  749. # if the release- as well as the debug-version of the library have been found:
  750. IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
  751. # if the generator supports configuration types then set
  752. # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
  753. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  754. SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
  755. ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  756. # if there are no configuration types and CMAKE_BUILD_TYPE has no value
  757. # then just use the release libraries
  758. SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} )
  759. ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  760. SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
  761. ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
  762. # if only the release version was found, set the debug variable also to the release version
  763. IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
  764. SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE})
  765. SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE})
  766. SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE})
  767. ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
  768. # if only the debug version was found, set the release variable also to the debug version
  769. IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
  770. SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG})
  771. SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG})
  772. SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG})
  773. ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
  774. # put the value in the cache:
  775. SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE)
  776. IF (QT_${basename}_LIBRARY)
  777. SET(QT_${basename}_FOUND 1)
  778. ENDIF (QT_${basename}_LIBRARY)
  779. ENDIF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
  780. IF (QT_${basename}_INCLUDE_DIR)
  781. #add the include directory to QT_INCLUDES
  782. SET(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES})
  783. ENDIF (QT_${basename}_INCLUDE_DIR)
  784. # Make variables changeble to the advanced user
  785. MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR)
  786. ENDMACRO (_QT4_ADJUST_LIB_VARS)
  787. # Set QT_xyz_LIBRARY variable and add
  788. # library include path to QT_INCLUDES
  789. _QT4_ADJUST_LIB_VARS(QTCORE)
  790. _QT4_ADJUST_LIB_VARS(QTGUI)
  791. _QT4_ADJUST_LIB_VARS(QT3SUPPORT)
  792. _QT4_ADJUST_LIB_VARS(QTASSISTANT)
  793. _QT4_ADJUST_LIB_VARS(QTASSISTANTCLIENT)
  794. _QT4_ADJUST_LIB_VARS(QTCLUCENE)
  795. _QT4_ADJUST_LIB_VARS(QTDBUS)
  796. _QT4_ADJUST_LIB_VARS(QTDESIGNER)
  797. _QT4_ADJUST_LIB_VARS(QTDESIGNERCOMPONENTS)
  798. _QT4_ADJUST_LIB_VARS(QTHELP)
  799. _QT4_ADJUST_LIB_VARS(QTMULTIMEDIA)
  800. _QT4_ADJUST_LIB_VARS(QTNETWORK)
  801. _QT4_ADJUST_LIB_VARS(QTNSPLUGIN)
  802. _QT4_ADJUST_LIB_VARS(QTOPENGL)
  803. _QT4_ADJUST_LIB_VARS(QTSCRIPT)
  804. _QT4_ADJUST_LIB_VARS(QTSCRIPTTOOLS)
  805. _QT4_ADJUST_LIB_VARS(QTSQL)
  806. _QT4_ADJUST_LIB_VARS(QTSVG)
  807. _QT4_ADJUST_LIB_VARS(QTTEST)
  808. _QT4_ADJUST_LIB_VARS(QTUITOOLS)
  809. _QT4_ADJUST_LIB_VARS(QTWEBKIT)
  810. _QT4_ADJUST_LIB_VARS(QTXML)
  811. _QT4_ADJUST_LIB_VARS(QTXMLPATTERNS)
  812. _QT4_ADJUST_LIB_VARS(PHONON)
  813. # platform dependent libraries
  814. IF(Q_WS_X11)
  815. _QT4_ADJUST_LIB_VARS(QTMOTIF)
  816. ENDIF(Q_WS_X11)
  817. IF(WIN32)
  818. _QT4_ADJUST_LIB_VARS(QTMAIN)
  819. _QT4_ADJUST_LIB_VARS(QAXSERVER)
  820. _QT4_ADJUST_LIB_VARS(QAXCONTAINER)
  821. ENDIF(WIN32)
  822. # If Qt is installed as a framework, we need to add QT_QTCORE_LIBRARY here (which
  823. # is the framework directory in that case), since this will make the cmake include_directories()
  824. # command recognize that we need the framework flag with the respective directory (-F)
  825. IF(QT_USE_FRAMEWORKS)
  826. SET(QT_INCLUDES ${QT_INCLUDES} ${QT_QTCORE_LIBRARY} )
  827. SET(QT_INCLUDE_DIR ${QT_INCLUDE_DIR} ${QT_QTCORE_LIBRARY} )
  828. ENDIF(QT_USE_FRAMEWORKS)
  829. #######################################
  830. #
  831. # Check the executables of Qt
  832. # ( moc, uic, rcc )
  833. #
  834. #######################################
  835. IF(QT_QMAKE_CHANGED)
  836. SET(QT_UIC_EXECUTABLE NOTFOUND)
  837. SET(QT_MOC_EXECUTABLE NOTFOUND)
  838. SET(QT_UIC3_EXECUTABLE NOTFOUND)
  839. SET(QT_RCC_EXECUTABLE NOTFOUND)
  840. SET(QT_DBUSCPP2XML_EXECUTABLE NOTFOUND)
  841. SET(QT_DBUSXML2CPP_EXECUTABLE NOTFOUND)
  842. SET(QT_LUPDATE_EXECUTABLE NOTFOUND)
  843. SET(QT_LRELEASE_EXECUTABLE NOTFOUND)
  844. SET(QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND)
  845. SET(QT_DESIGNER_EXECUTABLE NOTFOUND)
  846. SET(QT_LINGUIST_EXECUTABLE NOTFOUND)
  847. ENDIF(QT_QMAKE_CHANGED)
  848. FIND_PROGRAM(QT_MOC_EXECUTABLE
  849. NAMES moc-qt4 moc
  850. PATHS ${QT_BINARY_DIR}
  851. NO_DEFAULT_PATH
  852. )
  853. FIND_PROGRAM(QT_UIC_EXECUTABLE
  854. NAMES uic-qt4 uic
  855. PATHS ${QT_BINARY_DIR}
  856. NO_DEFAULT_PATH
  857. )
  858. FIND_PROGRAM(QT_UIC3_EXECUTABLE
  859. NAMES uic3
  860. PATHS ${QT_BINARY_DIR}
  861. NO_DEFAULT_PATH
  862. )
  863. FIND_PROGRAM(QT_RCC_EXECUTABLE
  864. NAMES rcc
  865. PATHS ${QT_BINARY_DIR}
  866. NO_DEFAULT_PATH
  867. )
  868. FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE
  869. NAMES qdbuscpp2xml
  870. PATHS ${QT_BINARY_DIR}
  871. NO_DEFAULT_PATH
  872. )
  873. FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE
  874. NAMES qdbusxml2cpp
  875. PATHS ${QT_BINARY_DIR}
  876. NO_DEFAULT_PATH
  877. )
  878. FIND_PROGRAM(QT_LUPDATE_EXECUTABLE
  879. NAMES lupdate-qt4 lupdate
  880. PATHS ${QT_BINARY_DIR}
  881. NO_DEFAULT_PATH
  882. )
  883. FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
  884. NAMES lrelease-qt4 lrelease
  885. PATHS ${QT_BINARY_DIR}
  886. NO_DEFAULT_PATH
  887. )
  888. FIND_PROGRAM(QT_QCOLLECTIONGENERATOR_EXECUTABLE
  889. NAMES qcollectiongenerator-qt4 qcollectiongenerator
  890. PATHS ${QT_BINARY_DIR}
  891. NO_DEFAULT_PATH
  892. )
  893. FIND_PROGRAM(QT_DESIGNER_EXECUTABLE
  894. NAMES designer-qt4 designer
  895. PATHS ${QT_BINARY_DIR}
  896. NO_DEFAULT_PATH
  897. )
  898. FIND_PROGRAM(QT_LINGUIST_EXECUTABLE
  899. NAMES linguist-qt4 linguist
  900. PATHS ${QT_BINARY_DIR}
  901. NO_DEFAULT_PATH
  902. )
  903. IF (QT_MOC_EXECUTABLE)
  904. SET(QT_WRAP_CPP "YES")
  905. ENDIF (QT_MOC_EXECUTABLE)
  906. IF (QT_UIC_EXECUTABLE)
  907. SET(QT_WRAP_UI "YES")
  908. ENDIF (QT_UIC_EXECUTABLE)
  909. MARK_AS_ADVANCED( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE
  910. QT_RCC_EXECUTABLE QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_EXECUTABLE
  911. QT_LUPDATE_EXECUTABLE QT_LRELEASE_EXECUTABLE QT_QCOLLECTIONGENERATOR_EXECUTABLE
  912. QT_DESIGNER_EXECUTABLE QT_LINGUIST_EXECUTABLE)
  913. # get the directory of the current file, used later on in the file
  914. GET_FILENAME_COMPONENT( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
  915. ######################################
  916. #
  917. # Macros for building Qt files
  918. #
  919. ######################################
  920. INCLUDE("${_qt4_current_dir}/Qt4Macros.cmake")
  921. ######################################
  922. #
  923. # decide if Qt got found
  924. #
  925. ######################################
  926. # if the includes,libraries,moc,uic and rcc are found then we have it
  927. IF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND
  928. QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY)
  929. SET( QT4_FOUND "YES" )
  930. INCLUDE(FindPackageMessage)
  931. FIND_PACKAGE_MESSAGE(Qt4 "Found Qt-Version ${QTVERSION} (using ${QT_QMAKE_EXECUTABLE})"
  932. "[${QT_LIBRARY_DIR}][${QT_INCLUDE_DIR}][${QT_MOC_EXECUTABLE}][${QT_UIC_EXECUTABLE}][${QT_RCC_EXECUTABLE}]")
  933. ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND
  934. QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY)
  935. SET( QT4_FOUND "NO")
  936. SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
  937. IF( Qt4_FIND_REQUIRED)
  938. MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!")
  939. ENDIF( Qt4_FIND_REQUIRED)
  940. ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND
  941. QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY)
  942. SET(QT_FOUND ${QT4_FOUND})
  943. ###############################################
  944. #
  945. # configuration/system dependent settings
  946. #
  947. ###############################################
  948. INCLUDE("${_qt4_current_dir}/Qt4ConfigDependentSettings.cmake")
  949. #######################################
  950. #
  951. # compatibility settings
  952. #
  953. #######################################
  954. # Backwards compatibility for CMake1.4 and 1.2
  955. SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} )
  956. SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} )
  957. SET( QT_QT_LIBRARY "")
  958. ELSE(QT4_QMAKE_FOUND)
  959. SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
  960. # The code below is overly complex to make sure we do not break compatibility with CMake 2.6.x
  961. # For CMake 2.8, it should be simplified by getting rid of QT4_INSTALLED_VERSION_TOO_OLD and
  962. # QT4_INSTALLED_VERSION_TOO_NEW
  963. IF(Qt4_FIND_REQUIRED)
  964. IF(QT4_INSTALLED_VERSION_TOO_OLD)
  965. IF( Qt4_FIND_VERSION_EXACT )
  966. MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, version ${QT_MIN_VERSION} is required")
  967. ELSE( Qt4_FIND_VERSION_EXACT )
  968. MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required")
  969. ENDIF( Qt4_FIND_VERSION_EXACT )
  970. ELSE(QT4_INSTALLED_VERSION_TOO_OLD)
  971. IF( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW )
  972. MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too new, version ${QT_MIN_VERSION} is required")
  973. ELSE( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW )
  974. MESSAGE( FATAL_ERROR "Qt qmake not found!")
  975. ENDIF( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW )
  976. ENDIF(QT4_INSTALLED_VERSION_TOO_OLD)
  977. ELSE(Qt4_FIND_REQUIRED)
  978. IF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
  979. MESSAGE(STATUS "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required")
  980. ENDIF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
  981. ENDIF(Qt4_FIND_REQUIRED)
  982. ENDIF (QT4_QMAKE_FOUND)