FindQt4.cmake 51 KB

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