FindQt4.cmake 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145
  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 REQUIRED QtCore QtGui QtXml)
  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_IMPORTS_DIR Path to "imports" of Qt4
  246. # QT_DOC_DIR Path to "doc" of Qt4
  247. # QT_MKSPECS_DIR Path to "mkspecs" of Qt4
  248. #
  249. #
  250. # The Qt toolkit may contain both debug and release libraries.
  251. # In that case, the following library variables will contain both.
  252. # You do not need to use these variables if you include QT_USE_FILE,
  253. # and use QT_LIBRARIES.
  254. #
  255. # QT_QT3SUPPORT_LIBRARY The Qt3Support library
  256. # QT_QTASSISTANT_LIBRARY The QtAssistant library
  257. # QT_QTASSISTANTCLIENT_LIBRARY The QtAssistantClient library
  258. # QT_QAXCONTAINER_LIBRARY The QAxContainer library (Windows only)
  259. # QT_QAXSERVER_LIBRARY The QAxServer library (Windows only)
  260. # QT_QTCORE_LIBRARY The QtCore library
  261. # QT_QTDBUS_LIBRARY The QtDBus library
  262. # QT_QTDESIGNER_LIBRARY The QtDesigner library
  263. # QT_QTDESIGNERCOMPONENTS_LIBRARY The QtDesignerComponents library
  264. # QT_QTGUI_LIBRARY The QtGui library
  265. # QT_QTHELP_LIBRARY The QtHelp library
  266. # QT_QTMOTIF_LIBRARY The QtMotif library
  267. # QT_QTMULTIMEDIA_LIBRARY The QtMultimedia library
  268. # QT_QTNETWORK_LIBRARY The QtNetwork library
  269. # QT_QTNSPLUGIN_LIBRARY The QtNsPLugin library
  270. # QT_QTOPENGL_LIBRARY The QtOpenGL library
  271. # QT_QTSCRIPT_LIBRARY The QtScript library
  272. # QT_QTSQL_LIBRARY The QtSql library
  273. # QT_QTSVG_LIBRARY The QtSvg library
  274. # QT_QTTEST_LIBRARY The QtTest library
  275. # QT_QTUITOOLS_LIBRARY The QtUiTools library
  276. # QT_QTWEBKIT_LIBRARY The QtWebKit library
  277. # QT_QTXML_LIBRARY The QtXml library
  278. # QT_QTXMLPATTERNS_LIBRARY The QtXmlPatterns library
  279. # QT_QTMAIN_LIBRARY The qtmain library for Windows
  280. # QT_PHONON_LIBRARY The phonon library
  281. # QT_QTSCRIPTTOOLS_LIBRARY The QtScriptTools library
  282. #
  283. # The QtDeclarative library: QT_QTDECLARATIVE_LIBRARY
  284. #
  285. # also defined, but NOT for general use are
  286. # QT_MOC_EXECUTABLE Where to find the moc tool.
  287. # QT_UIC_EXECUTABLE Where to find the uic tool.
  288. # QT_UIC3_EXECUTABLE Where to find the uic3 tool.
  289. # QT_RCC_EXECUTABLE Where to find the rcc tool
  290. # QT_DBUSCPP2XML_EXECUTABLE Where to find the qdbuscpp2xml tool.
  291. # QT_DBUSXML2CPP_EXECUTABLE Where to find the qdbusxml2cpp tool.
  292. # QT_LUPDATE_EXECUTABLE Where to find the lupdate tool.
  293. # QT_LRELEASE_EXECUTABLE Where to find the lrelease tool.
  294. # QT_QCOLLECTIONGENERATOR_EXECUTABLE Where to find the qcollectiongenerator tool.
  295. # QT_DESIGNER_EXECUTABLE Where to find the Qt designer tool.
  296. # QT_LINGUIST_EXECUTABLE Where to find the Qt linguist tool.
  297. #
  298. #
  299. # These are around for backwards compatibility
  300. # they will be set
  301. # QT_WRAP_CPP Set true if QT_MOC_EXECUTABLE is found
  302. # QT_WRAP_UI Set true if QT_UIC_EXECUTABLE is found
  303. #
  304. # These variables do _NOT_ have any effect anymore (compared to FindQt.cmake)
  305. # QT_MT_REQUIRED Qt4 is now always multithreaded
  306. #
  307. # These variables are set to "" Because Qt structure changed
  308. # (They make no sense in Qt4)
  309. # QT_QT_LIBRARY Qt-Library is now split
  310. #=============================================================================
  311. # Copyright 2005-2009 Kitware, Inc.
  312. #
  313. # Distributed under the OSI-approved BSD License (the "License");
  314. # see accompanying file Copyright.txt for details.
  315. #
  316. # This software is distributed WITHOUT ANY WARRANTY; without even the
  317. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  318. # See the License for more information.
  319. #=============================================================================
  320. # (To distribute this file outside of CMake, substitute the full
  321. # License text for the above reference.)
  322. # Use FIND_PACKAGE( Qt4 COMPONENTS ... ) to enable modules
  323. IF( Qt4_FIND_COMPONENTS )
  324. FOREACH( component ${Qt4_FIND_COMPONENTS} )
  325. STRING( TOUPPER ${component} _COMPONENT )
  326. SET( QT_USE_${_COMPONENT} 1 )
  327. ENDFOREACH( component )
  328. # To make sure we don't use QtCore or QtGui when not in COMPONENTS
  329. IF(NOT QT_USE_QTCORE)
  330. SET( QT_DONT_USE_QTCORE 1 )
  331. ENDIF(NOT QT_USE_QTCORE)
  332. IF(NOT QT_USE_QTGUI)
  333. SET( QT_DONT_USE_QTGUI 1 )
  334. ENDIF(NOT QT_USE_QTGUI)
  335. ENDIF( Qt4_FIND_COMPONENTS )
  336. # If Qt3 has already been found, fail.
  337. IF(QT_QT_LIBRARY)
  338. IF(Qt4_FIND_REQUIRED)
  339. MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.")
  340. ELSE(Qt4_FIND_REQUIRED)
  341. IF(NOT Qt4_FIND_QUIETLY)
  342. MESSAGE( STATUS "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.")
  343. ENDIF(NOT Qt4_FIND_QUIETLY)
  344. RETURN()
  345. ENDIF(Qt4_FIND_REQUIRED)
  346. ENDIF(QT_QT_LIBRARY)
  347. INCLUDE(CheckSymbolExists)
  348. INCLUDE(MacroAddFileDependencies)
  349. INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  350. SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
  351. SET( QT_DEFINITIONS "")
  352. # convenience macro for dealing with debug/release library names
  353. MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename)
  354. STRING(TOUPPER "${_camelCaseBasename}" basename)
  355. # The name of the imported targets, i.e. the prefix "Qt4::" must not change,
  356. # since it is stored in EXPORT-files as name of a required library. If the name would change
  357. # here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore.
  358. IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
  359. IF(NOT TARGET Qt4::${_camelCaseBasename})
  360. ADD_LIBRARY(Qt4::${_camelCaseBasename} UNKNOWN IMPORTED )
  361. IF (QT_${basename}_LIBRARY_RELEASE)
  362. SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
  363. SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" )
  364. ENDIF (QT_${basename}_LIBRARY_RELEASE)
  365. IF (QT_${basename}_LIBRARY_DEBUG)
  366. SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
  367. SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" )
  368. ENDIF (QT_${basename}_LIBRARY_DEBUG)
  369. ENDIF(NOT TARGET Qt4::${_camelCaseBasename})
  370. # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these
  371. # imported targets. This works better in general, and is also in almost all cases fully
  372. # backward compatible. The only issue is when a project A which had this enabled then exports its
  373. # libraries via export or EXPORT_LIBRARY_DEPENDENCIES(). In this case the libraries from project
  374. # A will depend on the imported Qt targets, and the names of these imported targets will be stored
  375. # in the dependency files on disk. This means when a project B then uses project A, these imported
  376. # targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a
  377. # library file on disk, and not as a target, and linking will fail:
  378. IF(QT_USE_IMPORTED_TARGETS)
  379. SET(QT_${basename}_LIBRARY Qt4::${_camelCaseBasename} )
  380. SET(QT_${basename}_LIBRARIES Qt4::${_camelCaseBasename} )
  381. ELSE(QT_USE_IMPORTED_TARGETS)
  382. # if the release- as well as the debug-version of the library have been found:
  383. IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
  384. # if the generator supports configuration types then set
  385. # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
  386. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  387. SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
  388. ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  389. # if there are no configuration types and CMAKE_BUILD_TYPE has no value
  390. # then just use the release libraries
  391. SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} )
  392. ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  393. SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
  394. ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
  395. # if only the release version was found, set the debug variable also to the release version
  396. IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
  397. SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE})
  398. SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE})
  399. SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE})
  400. ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
  401. # if only the debug version was found, set the release variable also to the debug version
  402. IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
  403. SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG})
  404. SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG})
  405. SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG})
  406. ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
  407. # put the value in the cache:
  408. SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE)
  409. ENDIF(QT_USE_IMPORTED_TARGETS)
  410. SET(QT_${basename}_FOUND 1)
  411. ELSE (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
  412. SET(QT_${basename}_LIBRARY "" CACHE STRING "The Qt ${basename} library" FORCE)
  413. ENDIF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
  414. IF (QT_${basename}_INCLUDE_DIR)
  415. #add the include directory to QT_INCLUDES
  416. SET(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES})
  417. ENDIF (QT_${basename}_INCLUDE_DIR)
  418. # Make variables changeble to the advanced user
  419. MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR)
  420. ENDMACRO (_QT4_ADJUST_LIB_VARS)
  421. function(_QT4_QUERY_QMAKE VAR RESULT)
  422. exec_program(${QT_QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output )
  423. if(NOT return_code)
  424. file(TO_CMAKE_PATH "${output}" output)
  425. set(${RESULT} ${output} PARENT_SCOPE)
  426. endif(NOT return_code)
  427. endfunction(_QT4_QUERY_QMAKE)
  428. SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
  429. GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
  430. # check for qmake
  431. # Debian uses qmake-qt4
  432. # macports' Qt uses qmake-mac
  433. FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac PATHS
  434. "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
  435. "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
  436. "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin"
  437. $ENV{QTDIR}/bin
  438. DOC "The qmake executable for the Qt installation to use"
  439. )
  440. # double check that it was a Qt4 qmake, if not, re-find with different names
  441. IF (QT_QMAKE_EXECUTABLE)
  442. IF(QT_QMAKE_EXECUTABLE_LAST)
  443. STRING(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED)
  444. ENDIF(QT_QMAKE_EXECUTABLE_LAST)
  445. SET(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE)
  446. _qt4_query_qmake(QT_VERSION QTVERSION)
  447. # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path
  448. IF(NOT QTVERSION)
  449. SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)
  450. FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS
  451. "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
  452. "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
  453. $ENV{QTDIR}/bin
  454. DOC "The qmake executable for the Qt installation to use"
  455. )
  456. IF(QT_QMAKE_EXECUTABLE)
  457. _qt4_query_qmake(QT_VERSION QTVERSION)
  458. ENDIF(QT_QMAKE_EXECUTABLE)
  459. ENDIF(NOT QTVERSION)
  460. ENDIF (QT_QMAKE_EXECUTABLE)
  461. IF (QT_QMAKE_EXECUTABLE AND QTVERSION)
  462. # ask qmake for the mkspecs directory
  463. # we do this first because QT_LIBINFIX might be set
  464. IF (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED)
  465. _qt4_query_qmake(QMAKE_MKSPECS qt_mkspecs_dirs)
  466. # do not replace : on windows as it might be a drive letter
  467. # and windows should already use ; as a separator
  468. IF(NOT WIN32)
  469. STRING(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}")
  470. ENDIF(NOT WIN32)
  471. set(qt_cross_paths)
  472. foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
  473. set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/mkspecs")
  474. endforeach(qt_cross_path)
  475. SET(QT_MKSPECS_DIR NOTFOUND)
  476. FIND_PATH(QT_MKSPECS_DIR NAMES qconfig.pri
  477. HINTS ${qt_cross_paths} ${qt_mkspecs_dirs}
  478. DOC "The location of the Qt mkspecs containing qconfig.pri")
  479. ENDIF()
  480. IF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
  481. FILE(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents)
  482. STRING(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}")
  483. STRING(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}")
  484. STRING(REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}")
  485. STRING(REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}")
  486. STRING(REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}")
  487. ENDIF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
  488. IF("${QT_EDITION}" MATCHES "DesktopLight")
  489. SET(QT_EDITION_DESKTOPLIGHT 1)
  490. ENDIF("${QT_EDITION}" MATCHES "DesktopLight")
  491. # ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the
  492. # others and for setting QT_LIBRARY_DIR
  493. IF (NOT QT_QTCORE_LIBRARY OR QT_QMAKE_CHANGED)
  494. _qt4_query_qmake(QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP)
  495. SET(QT_QTCORE_LIBRARY_RELEASE NOTFOUND)
  496. SET(QT_QTCORE_LIBRARY_DEBUG NOTFOUND)
  497. FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE
  498. NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4
  499. HINTS ${QT_LIBRARY_DIR_TMP}
  500. NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
  501. )
  502. FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG
  503. NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4
  504. HINTS ${QT_LIBRARY_DIR_TMP}
  505. NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
  506. )
  507. # try dropping a hint if trying to use Visual Studio with Qt built by mingw
  508. IF(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC)
  509. IF(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a)
  510. 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.")
  511. ENDIF(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a)
  512. ENDIF(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC)
  513. ENDIF (NOT QT_QTCORE_LIBRARY OR QT_QMAKE_CHANGED)
  514. _QT4_ADJUST_LIB_VARS(QtCore)
  515. # set QT_LIBRARY_DIR based on location of QtCore found.
  516. IF(QT_QTCORE_LIBRARY_RELEASE)
  517. GET_FILENAME_COMPONENT(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_RELEASE}" PATH)
  518. SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
  519. SET(QT_QTCORE_FOUND 1)
  520. ELSEIF(QT_QTCORE_LIBRARY_DEBUG)
  521. GET_FILENAME_COMPONENT(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_DEBUG}" PATH)
  522. SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
  523. SET(QT_QTCORE_FOUND 1)
  524. ELSE()
  525. MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}")
  526. MESSAGE("Warning: But QtCore couldn't be found. Qt must NOT be installed correctly, or it wasn't found for cross compiling.")
  527. IF(Qt4_FIND_REQUIRED)
  528. MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
  529. ENDIF(Qt4_FIND_REQUIRED)
  530. ENDIF()
  531. IF (APPLE)
  532. IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
  533. SET(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE)
  534. ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
  535. SET(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE)
  536. ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
  537. MARK_AS_ADVANCED(QT_USE_FRAMEWORKS)
  538. ENDIF (APPLE)
  539. # ask qmake for the binary dir
  540. IF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED)
  541. _qt4_query_qmake(QT_INSTALL_BINS qt_bins)
  542. SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE)
  543. ENDIF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED)
  544. # ask qmake for the include dir
  545. IF (QT_LIBRARY_DIR AND (NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED))
  546. _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers)
  547. SET(QT_QTCORE_INCLUDE_DIR NOTFOUND)
  548. FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore
  549. HINTS ${qt_headers}
  550. ${QT_LIBRARY_DIR}/QtCore.framework/Headers
  551. PATH_SUFFIXES QtCore
  552. )
  553. # Set QT_HEADERS_DIR based on finding QtCore header
  554. IF(QT_QTCORE_INCLUDE_DIR)
  555. IF(QT_USE_FRAMEWORKS)
  556. SET(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE)
  557. ELSE(QT_USE_FRAMEWORKS)
  558. GET_FILENAME_COMPONENT(qt_headers "${QT_QTCORE_INCLUDE_DIR}/../" ABSOLUTE)
  559. SET(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE)
  560. ENDIF(QT_USE_FRAMEWORKS)
  561. ELSEIF()
  562. MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_HEADERS as ${qt_headers}")
  563. MESSAGE("Warning: But QtCore couldn't be found. Qt must NOT be installed correctly.")
  564. ENDIF()
  565. ENDIF()
  566. # Set QT_INCLUDE_DIR based on QT_HEADERS_DIR
  567. IF(QT_HEADERS_DIR)
  568. IF(QT_USE_FRAMEWORKS)
  569. # Qt/Mac frameworks has two include dirs.
  570. # One is the framework include for which CMake will add a -F flag
  571. # and the other is an include dir for non-framework Qt modules
  572. SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR} ${QT_QTCORE_LIBRARY} )
  573. ELSE(QT_USE_FRAMEWORKS)
  574. SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR})
  575. ENDIF(QT_USE_FRAMEWORKS)
  576. ENDIF(QT_HEADERS_DIR)
  577. # Set QT_INCLUDES
  578. SET( QT_INCLUDES ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
  579. # ask qmake for the documentation directory
  580. IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED)
  581. _qt4_query_qmake(QT_INSTALL_DOCS qt_doc_dir)
  582. SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE)
  583. ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED)
  584. # ask qmake for the plugins directory
  585. IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED)
  586. _qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir)
  587. SET(QT_PLUGINS_DIR NOTFOUND)
  588. foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
  589. set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins")
  590. endforeach(qt_cross_path)
  591. FIND_PATH(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer
  592. HINTS ${qt_cross_paths} ${qt_plugins_dir}
  593. DOC "The location of the Qt plugins")
  594. ENDIF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED)
  595. # ask qmake for the translations directory
  596. IF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED)
  597. _qt4_query_qmake(QT_INSTALL_TRANSLATIONS qt_translations_dir)
  598. SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE)
  599. ENDIF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED)
  600. # ask qmake for the imports directory
  601. IF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED)
  602. _qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir)
  603. if(qt_imports_dir)
  604. SET(QT_IMPORTS_DIR NOTFOUND)
  605. foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
  606. set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports")
  607. endforeach(qt_cross_path)
  608. FIND_PATH(QT_IMPORTS_DIR NAMES Qt
  609. HINTS ${qt_cross_paths} ${qt_imports_dir}
  610. DOC "The location of the Qt imports"
  611. NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
  612. NO_CMAKE_SYSTEM_PATH)
  613. mark_as_advanced(QT_IMPORTS_DIR)
  614. endif(qt_imports_dir)
  615. ENDIF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED)
  616. # Make variables changeble to the advanced user
  617. MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR
  618. QT_PLUGINS_DIR QT_TRANSLATIONS_DIR)
  619. #############################################
  620. #
  621. # Find out what window system we're using
  622. #
  623. #############################################
  624. # Save required variable
  625. SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
  626. SET(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
  627. # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
  628. SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}")
  629. # Check for Window system symbols (note: only one should end up being set)
  630. CHECK_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11)
  631. CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
  632. CHECK_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS)
  633. CHECK_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC)
  634. IF(Q_WS_MAC)
  635. IF(QT_QMAKE_CHANGED)
  636. UNSET(QT_MAC_USE_COCOA CACHE)
  637. ENDIF(QT_QMAKE_CHANGED)
  638. CHECK_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA)
  639. ENDIF(Q_WS_MAC)
  640. IF (QT_QTCOPY_REQUIRED)
  641. CHECK_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY)
  642. IF (NOT QT_IS_QTCOPY)
  643. MESSAGE(FATAL_ERROR "qt-copy is required, but hasn't been found")
  644. ENDIF (NOT QT_IS_QTCOPY)
  645. ENDIF (QT_QTCOPY_REQUIRED)
  646. # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
  647. SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
  648. SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
  649. #
  650. #############################################
  651. ########################################
  652. #
  653. # Setting the INCLUDE-Variables
  654. #
  655. ########################################
  656. SET(QT_MODULES QtGui Qt3Support QtSvg QtScript QtTest QtUiTools
  657. QtHelp QtWebKit QtXmlPatterns phonon QtNetwork QtMultimedia
  658. QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools
  659. QtDeclarative)
  660. IF(Q_WS_X11)
  661. SET(QT_MODULES ${QT_MODULES} QtMotif)
  662. ENDIF(Q_WS_X11)
  663. IF(QT_QMAKE_CHANGED)
  664. FOREACH(QT_MODULE ${QT_MODULES})
  665. STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
  666. SET(QT_${_upper_qt_module}_INCLUDE_DIR NOTFOUND)
  667. SET(QT_${_upper_qt_module}_LIBRARY_RELEASE NOTFOUND)
  668. SET(QT_${_upper_qt_module}_LIBRARY_DEBUG NOTFOUND)
  669. ENDFOREACH(QT_MODULE)
  670. SET(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR NOTFOUND)
  671. SET(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NOTFOUND)
  672. SET(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NOTFOUND)
  673. SET(QT_QTASSISTANTCLIENT_INCLUDE_DIR NOTFOUND)
  674. SET(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NOTFOUND)
  675. SET(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NOTFOUND)
  676. SET(QT_QTASSISTANT_INCLUDE_DIR NOTFOUND)
  677. SET(QT_QTASSISTANT_LIBRARY_RELEASE NOTFOUND)
  678. SET(QT_QTASSISTANT_LIBRARY_DEBUG NOTFOUND)
  679. SET(QT_QTCLUCENE_LIBRARY_RELEASE NOTFOUND)
  680. SET(QT_QTCLUCENE_LIBRARY_DEBUG NOTFOUND)
  681. SET(QT_QAXCONTAINER_INCLUDE_DIR NOTFOUND)
  682. SET(QT_QAXCONTAINER_LIBRARY_RELEASE NOTFOUND)
  683. SET(QT_QAXCONTAINER_LIBRARY_DEBUG NOTFOUND)
  684. SET(QT_QAXSERVER_INCLUDE_DIR NOTFOUND)
  685. SET(QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND)
  686. SET(QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND)
  687. IF(Q_WS_WIN)
  688. SET(QT_QTMAIN_LIBRARY_DEBUG NOTFOUND)
  689. SET(QT_QTMAIN_LIBRARY_RELEASE NOTFOUND)
  690. ENDIF(Q_WS_WIN)
  691. ENDIF(QT_QMAKE_CHANGED)
  692. FOREACH(QT_MODULE ${QT_MODULES})
  693. STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
  694. FIND_PATH(QT_${_upper_qt_module}_INCLUDE_DIR ${QT_MODULE}
  695. PATHS
  696. ${QT_HEADERS_DIR}/${QT_MODULE}
  697. ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers
  698. NO_DEFAULT_PATH
  699. )
  700. # phonon doesn't seem consistent, let's try phonondefs.h for some
  701. # installations
  702. IF(${QT_MODULE} STREQUAL "phonon")
  703. FIND_PATH(QT_${_upper_qt_module}_INCLUDE_DIR phonondefs.h
  704. PATHS
  705. ${QT_HEADERS_DIR}/${QT_MODULE}
  706. ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers
  707. NO_DEFAULT_PATH
  708. )
  709. ENDIF(${QT_MODULE} STREQUAL "phonon")
  710. ENDFOREACH(QT_MODULE)
  711. IF(Q_WS_WIN)
  712. SET(QT_MODULES ${QT_MODULES} QAxContainer QAxServer)
  713. # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR
  714. FIND_PATH(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt
  715. PATHS ${QT_HEADERS_DIR}/ActiveQt
  716. NO_DEFAULT_PATH
  717. )
  718. FIND_PATH(QT_QAXSERVER_INCLUDE_DIR ActiveQt
  719. PATHS ${QT_HEADERS_DIR}/ActiveQt
  720. NO_DEFAULT_PATH
  721. )
  722. ENDIF(Q_WS_WIN)
  723. # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR
  724. FIND_PATH(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents
  725. PATHS
  726. ${QT_HEADERS_DIR}/QtDesigner
  727. ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers
  728. NO_DEFAULT_PATH
  729. )
  730. # Set QT_QTASSISTANT_INCLUDE_DIR
  731. FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QtAssistant
  732. PATHS
  733. ${QT_HEADERS_DIR}/QtAssistant
  734. ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers
  735. NO_DEFAULT_PATH
  736. )
  737. # Set QT_QTASSISTANTCLIENT_INCLUDE_DIR
  738. FIND_PATH(QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient
  739. PATHS
  740. ${QT_HEADERS_DIR}/QtAssistant
  741. ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers
  742. NO_DEFAULT_PATH
  743. )
  744. ########################################
  745. #
  746. # Setting the LIBRARY-Variables
  747. #
  748. ########################################
  749. # find the libraries
  750. FOREACH(QT_MODULE ${QT_MODULES})
  751. STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
  752. FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_RELEASE
  753. NAMES ${QT_MODULE}${QT_LIBINFIX} ${QT_MODULE}${QT_LIBINFIX}4
  754. PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH
  755. )
  756. FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_DEBUG
  757. NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4
  758. PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH
  759. )
  760. ENDFOREACH(QT_MODULE)
  761. # QtUiTools not with other frameworks with binary installation (in /usr/lib)
  762. IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE)
  763. FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR})
  764. ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE)
  765. # Set QT_QTDESIGNERCOMPONENTS_LIBRARY
  766. FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents${QT_LIBINFIX} QtDesignerComponents${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
  767. 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)
  768. # Set QT_QTMAIN_LIBRARY
  769. IF(Q_WS_WIN)
  770. FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
  771. FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
  772. ENDIF(Q_WS_WIN)
  773. # Set QT_QTASSISTANTCLIENT_LIBRARY
  774. FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
  775. 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)
  776. # Set QT_QTASSISTANT_LIBRARY
  777. 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)
  778. 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)
  779. # Set QT_QTHELP_LIBRARY
  780. FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
  781. 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)
  782. IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE)
  783. FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR})
  784. ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE)
  785. ############################################
  786. #
  787. # Check the existence of the libraries.
  788. #
  789. ############################################
  790. # On OSX when Qt is found as framework, never use the imported targets for now, since
  791. # in this case the handling of the framework directory currently does not work correctly.
  792. IF(QT_USE_FRAMEWORKS)
  793. SET(QT_USE_IMPORTED_TARGETS FALSE)
  794. ENDIF(QT_USE_FRAMEWORKS)
  795. # Set QT_xyz_LIBRARY variable and add
  796. # library include path to QT_INCLUDES
  797. FOREACH(QT_MODULE ${QT_MODULES})
  798. _QT4_ADJUST_LIB_VARS(${QT_MODULE})
  799. ENDFOREACH(QT_MODULE)
  800. _QT4_ADJUST_LIB_VARS(QtAssistant)
  801. _QT4_ADJUST_LIB_VARS(QtAssistantClient)
  802. _QT4_ADJUST_LIB_VARS(QtCLucene)
  803. _QT4_ADJUST_LIB_VARS(QtDesignerComponents)
  804. # platform dependent libraries
  805. IF(Q_WS_WIN)
  806. _QT4_ADJUST_LIB_VARS(qtmain)
  807. _QT4_ADJUST_LIB_VARS(QAxServer)
  808. _QT4_ADJUST_LIB_VARS(QAxContainer)
  809. ENDIF(Q_WS_WIN)
  810. #######################################
  811. #
  812. # Check the executables of Qt
  813. # ( moc, uic, rcc )
  814. #
  815. #######################################
  816. IF(QT_QMAKE_CHANGED)
  817. SET(QT_UIC_EXECUTABLE NOTFOUND)
  818. SET(QT_MOC_EXECUTABLE NOTFOUND)
  819. SET(QT_UIC3_EXECUTABLE NOTFOUND)
  820. SET(QT_RCC_EXECUTABLE NOTFOUND)
  821. SET(QT_DBUSCPP2XML_EXECUTABLE NOTFOUND)
  822. SET(QT_DBUSXML2CPP_EXECUTABLE NOTFOUND)
  823. SET(QT_LUPDATE_EXECUTABLE NOTFOUND)
  824. SET(QT_LRELEASE_EXECUTABLE NOTFOUND)
  825. SET(QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND)
  826. SET(QT_DESIGNER_EXECUTABLE NOTFOUND)
  827. SET(QT_LINGUIST_EXECUTABLE NOTFOUND)
  828. ENDIF(QT_QMAKE_CHANGED)
  829. FIND_PROGRAM(QT_MOC_EXECUTABLE
  830. NAMES moc-qt4 moc
  831. PATHS ${QT_BINARY_DIR}
  832. NO_DEFAULT_PATH
  833. )
  834. FIND_PROGRAM(QT_UIC_EXECUTABLE
  835. NAMES uic-qt4 uic
  836. PATHS ${QT_BINARY_DIR}
  837. NO_DEFAULT_PATH
  838. )
  839. FIND_PROGRAM(QT_UIC3_EXECUTABLE
  840. NAMES uic3
  841. PATHS ${QT_BINARY_DIR}
  842. NO_DEFAULT_PATH
  843. )
  844. FIND_PROGRAM(QT_RCC_EXECUTABLE
  845. NAMES rcc
  846. PATHS ${QT_BINARY_DIR}
  847. NO_DEFAULT_PATH
  848. )
  849. FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE
  850. NAMES qdbuscpp2xml
  851. PATHS ${QT_BINARY_DIR}
  852. NO_DEFAULT_PATH
  853. )
  854. FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE
  855. NAMES qdbusxml2cpp
  856. PATHS ${QT_BINARY_DIR}
  857. NO_DEFAULT_PATH
  858. )
  859. FIND_PROGRAM(QT_LUPDATE_EXECUTABLE
  860. NAMES lupdate-qt4 lupdate
  861. PATHS ${QT_BINARY_DIR}
  862. NO_DEFAULT_PATH
  863. )
  864. FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
  865. NAMES lrelease-qt4 lrelease
  866. PATHS ${QT_BINARY_DIR}
  867. NO_DEFAULT_PATH
  868. )
  869. FIND_PROGRAM(QT_QCOLLECTIONGENERATOR_EXECUTABLE
  870. NAMES qcollectiongenerator-qt4 qcollectiongenerator
  871. PATHS ${QT_BINARY_DIR}
  872. NO_DEFAULT_PATH
  873. )
  874. FIND_PROGRAM(QT_DESIGNER_EXECUTABLE
  875. NAMES designer-qt4 designer
  876. PATHS ${QT_BINARY_DIR}
  877. NO_DEFAULT_PATH
  878. )
  879. FIND_PROGRAM(QT_LINGUIST_EXECUTABLE
  880. NAMES linguist-qt4 linguist
  881. PATHS ${QT_BINARY_DIR}
  882. NO_DEFAULT_PATH
  883. )
  884. IF (QT_MOC_EXECUTABLE)
  885. SET(QT_WRAP_CPP "YES")
  886. ENDIF (QT_MOC_EXECUTABLE)
  887. IF (QT_UIC_EXECUTABLE)
  888. SET(QT_WRAP_UI "YES")
  889. ENDIF (QT_UIC_EXECUTABLE)
  890. MARK_AS_ADVANCED( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE
  891. QT_RCC_EXECUTABLE QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_EXECUTABLE
  892. QT_LUPDATE_EXECUTABLE QT_LRELEASE_EXECUTABLE QT_QCOLLECTIONGENERATOR_EXECUTABLE
  893. QT_DESIGNER_EXECUTABLE QT_LINGUIST_EXECUTABLE)
  894. # get the directory of the current file, used later on in the file
  895. GET_FILENAME_COMPONENT( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
  896. ###############################################
  897. #
  898. # configuration/system dependent settings
  899. #
  900. ###############################################
  901. INCLUDE("${_qt4_current_dir}/Qt4ConfigDependentSettings.cmake")
  902. #######################################
  903. #
  904. # Check the plugins of Qt
  905. #
  906. #######################################
  907. SET( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers )
  908. SET( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets )
  909. SET( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer )
  910. SET( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs )
  911. SET( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows )
  912. SET( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin )
  913. SET( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb )
  914. SET( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem )
  915. SET( QT_ICONENGINES_PLUGINS qsvgicon )
  916. SET( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff )
  917. SET( QT_INPUTMETHODS_PLUGINS qimsw_multi )
  918. SET( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler )
  919. SET( QT_PHONON_BACKEND_PLUGINS phonon_qt7 )
  920. SET( QT_SCRIPT_PLUGINS qtscriptdbus )
  921. SET( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds )
  922. IF(QT_QMAKE_CHANGED)
  923. FOREACH(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES})
  924. STRING(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type)
  925. SET(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE})
  926. FOREACH(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS})
  927. STRING(TOUPPER ${QT_PLUGIN} _upper_qt_plugin)
  928. UNSET(QT_${_upper_qt_plugin}_LIBRARY_RELEASE CACHE)
  929. UNSET(QT_${_upper_qt_plugin}_LIBRARY_DEBUG CACHE)
  930. UNSET(QT_${_upper_qt_plugin}_LIBRARY CACHE)
  931. UNSET(QT_${_upper_qt_plugin}_PLUGIN_RELEASE CACHE)
  932. UNSET(QT_${_upper_qt_plugin}_PLUGIN_DEBUG CACHE)
  933. UNSET(QT_${_upper_qt_plugin}_PLUGIN CACHE)
  934. ENDFOREACH(QT_PLUGIN)
  935. ENDFOREACH(QT_PLUGIN_TYPE)
  936. ENDIF(QT_QMAKE_CHANGED)
  937. # find_library works better than find_file but we need to set prefixes to only match plugins
  938. FOREACH(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES})
  939. STRING(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type)
  940. SET(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE})
  941. FOREACH(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS})
  942. STRING(TOUPPER ${QT_PLUGIN} _upper_qt_plugin)
  943. IF(QT_IS_STATIC)
  944. FIND_LIBRARY(QT_${_upper_qt_plugin}_LIBRARY_RELEASE
  945. NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4
  946. PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH
  947. )
  948. FIND_LIBRARY(QT_${_upper_qt_plugin}_LIBRARY_DEBUG
  949. NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4
  950. PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH
  951. )
  952. _QT4_ADJUST_LIB_VARS(${QT_PLUGIN})
  953. ELSE(QT_IS_STATIC)
  954. # find_library works easier/better than find_file but we need to set suffixes to only match plugins
  955. SET(CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${CMAKE_FIND_LIBRARY_SUFFIXES})
  956. SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_MODULE_SUFFIX} ${CMAKE_SHARED_LIBRARY_SUFFIX})
  957. FIND_LIBRARY(QT_${_upper_qt_plugin}_PLUGIN_RELEASE
  958. NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4
  959. PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH
  960. )
  961. FIND_LIBRARY(QT_${_upper_qt_plugin}_PLUGIN_DEBUG
  962. NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4
  963. PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH
  964. )
  965. MARK_AS_ADVANCED(QT_${_upper_qt_plugin}_PLUGIN_RELEASE QT_${_upper_qt_plugin}_PLUGIN_DEBUG)
  966. SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT})
  967. ENDIF(QT_IS_STATIC)
  968. ENDFOREACH(QT_PLUGIN)
  969. ENDFOREACH(QT_PLUGIN_TYPE)
  970. ######################################
  971. #
  972. # Macros for building Qt files
  973. #
  974. ######################################
  975. INCLUDE("${_qt4_current_dir}/Qt4Macros.cmake")
  976. ENDIF(QT_QMAKE_EXECUTABLE AND QTVERSION)
  977. #support old QT_MIN_VERSION if set, but not if version is supplied by find_package()
  978. IF(NOT Qt4_FIND_VERSION AND QT_MIN_VERSION)
  979. SET(Qt4_FIND_VERSION ${QT_MIN_VERSION})
  980. ENDIF(NOT Qt4_FIND_VERSION AND QT_MIN_VERSION)
  981. IF( Qt4_FIND_COMPONENTS )
  982. # if components specified in find_package(), make sure each of those pieces were found
  983. SET(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR)
  984. FOREACH( component ${Qt4_FIND_COMPONENTS} )
  985. STRING( TOUPPER ${component} _COMPONENT )
  986. SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_INCLUDE_DIR QT_${_COMPONENT}_LIBRARY)
  987. ENDFOREACH( component )
  988. if(Qt4_FIND_COMPONENTS MATCHES QtGui)
  989. SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_UIC_EXECUTABLE)
  990. endif(Qt4_FIND_COMPONENTS MATCHES QtGui)
  991. ELSE( Qt4_FIND_COMPONENTS )
  992. # if no components specified, we'll make a default set of required variables to say Qt is found
  993. SET(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR
  994. QT_LIBRARY_DIR QT_QTCORE_LIBRARY)
  995. ENDIF( Qt4_FIND_COMPONENTS )
  996. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4
  997. REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS}
  998. VERSION_VAR QTVERSION
  999. )
  1000. #######################################
  1001. #
  1002. # compatibility settings
  1003. #
  1004. #######################################
  1005. # Backwards compatibility for CMake1.4 and 1.2
  1006. SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} )
  1007. SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} )
  1008. SET( QT_QT_LIBRARY "")
  1009. SET(QT_FOUND ${QT4_FOUND})