UseQt4.cmake 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. # - Use Module for QT4
  2. # Sets up C and C++ to use Qt 4. It is assumed that FindQt.cmake
  3. # has already been loaded. See FindQt.cmake for information on
  4. # how to load Qt 4 into your CMake project.
  5. ADD_DEFINITIONS(${QT_DEFINITIONS})
  6. INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
  7. SET(QT_LIBRARIES "")
  8. IF (NOT QT_DONT_USE_QTCORE)
  9. IF (QT_QTCORE_FOUND)
  10. INCLUDE_DIRECTORIES(${QT_QTCORE_INCLUDE_DIR})
  11. ADD_DEFINITIONS(-DQT_CORE_LIB)
  12. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  13. SET(QT_LIBRARIES ${QT_LIBRARIES}
  14. optimized "${QT_QTCORE_LIBRARY}"
  15. debug "${QT_QTCORE_LIBRARY_DEBUG}"
  16. )
  17. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  18. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTCORE_LIBRARY}" )
  19. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  20. IF (UNIX)
  21. IF (CMAKE_DL_LIBS)
  22. SET (QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_DL_LIBS})
  23. ENDIF (CMAKE_DL_LIBS)
  24. ENDIF (UNIX)
  25. ELSE (QT_QTCORE_FOUND)
  26. MESSAGE("QtCore library not found.")
  27. ENDIF (QT_QTCORE_FOUND)
  28. ENDIF (NOT QT_DONT_USE_QTCORE)
  29. IF (NOT QT_DONT_USE_QTGUI)
  30. IF (QT_QTGUI_FOUND)
  31. INCLUDE_DIRECTORIES(${QT_QTGUI_INCLUDE_DIR})
  32. ADD_DEFINITIONS(-DQT_GUI_LIB)
  33. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  34. SET(QT_LIBRARIES ${QT_LIBRARIES}
  35. optimized "${QT_QTGUI_LIBRARY}"
  36. debug "${QT_QTGUI_LIBRARY_DEBUG}"
  37. )
  38. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  39. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTGUI_LIBRARY}")
  40. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  41. IF (UNIX)
  42. IF (X11_FOUND)
  43. SET (QT_LIBRARIES ${QT_LIBRARIES} ${X11_LIBRARIES})
  44. ENDIF (X11_FOUND)
  45. ENDIF (UNIX)
  46. ELSE (QT_QTGUI_FOUND)
  47. MESSAGE("QtGui library not found.")
  48. ENDIF (QT_QTGUI_FOUND)
  49. ENDIF (NOT QT_DONT_USE_QTGUI)
  50. IF (QT_USE_QT3SUPPORT)
  51. IF (QT_QT3SUPPORT_FOUND)
  52. INCLUDE_DIRECTORIES(${QT_QT3SUPPORT_INCLUDE_DIR})
  53. ADD_DEFINITIONS(-DQT3_SUPPORT)
  54. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  55. SET(QT_LIBRARIES ${QT_LIBRARIES}
  56. optimized "${QT_QT3SUPPORT_LIBRARY}"
  57. debug "${QT_QT3SUPPORT_LIBRARY_DEBUG}"
  58. )
  59. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  60. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QT3SUPPORT_LIBRARY}")
  61. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  62. ELSE (QT_QT3SUPPORT_FOUND)
  63. MESSAGE("Qt3Support library not found.")
  64. ENDIF (QT_QT3SUPPORT_FOUND)
  65. ENDIF (QT_USE_QT3SUPPORT)
  66. IF (QT_USE_QTASSISTANT)
  67. IF (QT_QTASSISTANT_FOUND)
  68. INCLUDE_DIRECTORIES(${QT_QTASSISTANT_INCLUDE_DIR})
  69. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  70. SET(QT_LIBRARIES ${QT_LIBRARIES}
  71. optimized "${QT_QTASSISTANT_LIBRARY}"
  72. debug "${QT_QTASSISTANT_LIBRARY_DEBUG}"
  73. )
  74. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  75. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTASSISTANT_LIBRARY}")
  76. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  77. ELSE (QT_QTASSISTANT_FOUND)
  78. MESSAGE("QtAssistant library not found.")
  79. ENDIF (QT_QTASSISTANT_FOUND)
  80. ENDIF (QT_USE_QTASSISTANT)
  81. IF (QT_USE_QTDESIGNER)
  82. IF (QT_QTDESIGNER_FOUND)
  83. INCLUDE_DIRECTORIES(${QT_QTDESIGNER_INCLUDE_DIR})
  84. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  85. SET(QT_LIBRARIES ${QT_LIBRARIES}
  86. optimized "${QT_QTDESIGNER_LIBRARY}"
  87. debug "${QT_QTDESIGNER_LIBRARY_DEBUG}"
  88. )
  89. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  90. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTDESIGNER_LIBRARY}")
  91. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  92. ELSE (QT_QTDESIGNER_FOUND)
  93. MESSAGE("QtDesigner library not found.")
  94. ENDIF (QT_QTDESIGNER_FOUND)
  95. ENDIF (QT_USE_QTDESIGNER)
  96. IF (QT_USE_QTMAIN)
  97. IF (WIN32)
  98. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  99. SET(QT_LIBRARIES ${QT_LIBRARIES}
  100. optimized "${QT_QTMAIN_LIBRARY}"
  101. debug "${QT_QTMAIN_LIBRARY_DEBUG}"
  102. )
  103. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  104. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTMAIN_LIBRARY}")
  105. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  106. ENDIF (WIN32)
  107. ENDIF (QT_USE_QTMAIN)
  108. IF (QT_USE_QTMOTIF)
  109. IF (QT_QTMOTIF_FOUND)
  110. INCLUDE_DIRECTORIES(${QT_QTMOTIF_INCLUDE_DIR})
  111. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  112. SET(QT_LIBRARIES ${QT_LIBRARIES}
  113. optimized "${QT_QTMOTIF_LIBRARY}"
  114. debug "${QT_QTMOTIF_LIBRARY_DEBUG}"
  115. )
  116. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  117. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTMOTIF_LIBRARY}")
  118. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  119. ELSE (QT_QTMOTIF_FOUND)
  120. MESSAGE("QtMotif library not found.")
  121. ENDIF (QT_QTMOTIF_FOUND)
  122. ENDIF (QT_USE_QTMOTIF)
  123. IF (QT_USE_QTNETWORK)
  124. IF (QT_QTNETWORK_FOUND)
  125. INCLUDE_DIRECTORIES(${QT_QTNETWORK_INCLUDE_DIR})
  126. ADD_DEFINITIONS(-DQT_NETWORK_LIB)
  127. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  128. SET(QT_LIBRARIES ${QT_LIBRARIES}
  129. optimized "${QT_QTNETWORK_LIBRARY}"
  130. debug "${QT_QTNETWORK_LIBRARY_DEBUG}"
  131. )
  132. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  133. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTNETWORK_LIBRARY}")
  134. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  135. ELSE (QT_QTNETWORK_FOUND)
  136. MESSAGE("QtNetwork library not found.")
  137. ENDIF (QT_QTNETWORK_FOUND)
  138. ENDIF (QT_USE_QTNETWORK)
  139. IF (QT_USE_QTNSPLUGIN)
  140. IF (QT_QTNSPLUGIN_FOUND)
  141. INCLUDE_DIRECTORIES(${QT_QTNSPLUGIN_INCLUDE_DIR})
  142. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  143. SET(QT_LIBRARIES ${QT_LIBRARIES}
  144. optimized "${QT_QTNSPLUGIN_LIBRARY}"
  145. debug "${QT_QTNSPLUGIN_LIBRARY_DEBUG}"
  146. )
  147. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  148. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTNSPLUGIN_LIBRARY}")
  149. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  150. ELSE (QT_QTNSPLUGIN_FOUND)
  151. MESSAGE("QtNsPlugin library not found.")
  152. ENDIF (QT_QTNSPLUGIN_FOUND)
  153. ENDIF (QT_USE_QTNSPLUGIN)
  154. IF (QT_USE_QTOPENGL)
  155. IF (QT_QTOPENGL_FOUND)
  156. INCLUDE_DIRECTORIES(${QT_QTOPENGL_INCLUDE_DIR})
  157. ADD_DEFINITIONS(-DQT_OPENGL_LIB)
  158. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  159. SET(QT_LIBRARIES ${QT_LIBRARIES}
  160. optimized "${QT_QTOPENGL_LIBRARY}"
  161. debug "${QT_QTOPENGL_LIBRARY_DEBUG}"
  162. )
  163. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  164. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTOPENGL_LIBRARY}")
  165. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  166. ELSE (QT_QTOPENGL_FOUND)
  167. MESSAGE("QtOpenGL library not found.")
  168. ENDIF (QT_QTOPENGL_FOUND)
  169. ENDIF (QT_USE_QTOPENGL)
  170. IF (QT_USE_QTSQL)
  171. IF (QT_QTSQL_FOUND)
  172. INCLUDE_DIRECTORIES(${QT_QTSQL_INCLUDE_DIR})
  173. ADD_DEFINITIONS(-DQT_SQL_LIB)
  174. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  175. SET(QT_LIBRARIES ${QT_LIBRARIES}
  176. optimized "${QT_QTSQL_LIBRARY}"
  177. debug "${QT_QTSQL_LIBRARY_DEBUG}"
  178. )
  179. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  180. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTSQL_LIBRARY}")
  181. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  182. ELSE (QT_QTSQL_FOUND)
  183. MESSAGE("QtSql library not found.")
  184. ENDIF (QT_QTSQL_FOUND)
  185. ENDIF (QT_USE_QTSQL)
  186. IF (QT_USE_QTXML)
  187. IF (QT_QTXML_FOUND)
  188. INCLUDE_DIRECTORIES(${QT_QTXML_INCLUDE_DIR})
  189. ADD_DEFINITIONS(-DQT_XML_LIB)
  190. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  191. SET(QT_LIBRARIES ${QT_LIBRARIES}
  192. optimized "${QT_QTXML_LIBRARY}"
  193. debug "${QT_QTXML_LIBRARY_DEBUG}"
  194. )
  195. ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  196. SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTXML_LIBRARY}")
  197. ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  198. ELSE (QT_QTXML_FOUND)
  199. MESSAGE("QtXml library not found.")
  200. ENDIF (QT_QTXML_FOUND)
  201. ENDIF (QT_USE_QTXML)