Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Modules / UseQt4.cmake
blob29de8cb539eefa22d1b385f4619622630f6f8475
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.
7 ADD_DEFINITIONS(${QT_DEFINITIONS})
8 SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG)
9 SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
10 SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
11 SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)
13 INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
14 IF(Q_WS_MAC AND QT_USE_FRAMEWORKS)
15   INCLUDE_DIRECTORIES(${QT_QTCORE_LIBRARY})
16 ENDIF(Q_WS_MAC AND QT_USE_FRAMEWORKS)
18 SET(QT_LIBRARIES "")
20 IF (QT_USE_QTMAIN)
21   IF (WIN32)
22     SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
23   ENDIF (WIN32)
24 ENDIF (QT_USE_QTMAIN)
26 IF(QT_DONT_USE_QTGUI)
27   SET(QT_USE_QTGUI 0)
28 ELSE(QT_DONT_USE_QTGUI)
29   SET(QT_USE_QTGUI 1)
30 ENDIF(QT_DONT_USE_QTGUI)
32 IF(QT_DONT_USE_QTCORE)
33   SET(QT_USE_QTCORE 0)
34 ELSE(QT_DONT_USE_QTCORE)
35   SET(QT_USE_QTCORE 1)
36 ENDIF(QT_DONT_USE_QTCORE)
38 IF (QT_USE_QT3SUPPORT)
39   ADD_DEFINITIONS(-DQT3_SUPPORT)
40 ENDIF (QT_USE_QT3SUPPORT)
42 # list dependent modules, so dependent libraries are added
43 SET(QT_QT3SUPPORT_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE)
44 SET(QT_QTSVG_MODULE_DEPENDS QTGUI QTXML QTCORE)
45 SET(QT_QTUITOOLS_MODULE_DEPENDS QTGUI QTXML QTCORE)
46 SET(QT_QTHELP_MODULE_DEPENDS QTGUI QTSQL QTXML QTCORE)
47 IF(QT_QTDBUS_FOUND)
48   SET(QT_PHONON_MODULE_DEPENDS QTGUI QTDBUS QTCORE)
49 ELSE(QT_QTDBUS_FOUND)
50   SET(QT_PHONON_MODULE_DEPENDS QTGUI QTCORE)
51 ENDIF(QT_QTDBUS_FOUND)
52 SET(QT_QTDBUS_MODULE_DEPENDS QTXML QTCORE)
53 SET(QT_QTXMLPATTERNS_MODULE_DEPENDS QTNETWORK QTCORE)
54 SET(QT_QAXCONTAINER_MODULE_DEPENDS QTGUI QTCORE)
55 SET(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE)
57 # Qt modules  (in order of dependence)
58 FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
59                QAXSERVER QAXCONTAINER QTSCRIPT QTSVG QTUITOOLS QTHELP 
60                QTWEBKIT PHONON QTGUI QTTEST QTDBUS QTXML QTSQL QTXMLPATTERNS 
61                QTNETWORK QTCORE)
63   IF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
64     IF (QT_${module}_FOUND)
65       IF(QT_USE_${module})
66         STRING(REPLACE "QT" "" qt_module_def "${module}")
67         ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB)
68         INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR})
69       ENDIF(QT_USE_${module})
70       SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY} ${QT_${module}_LIB_DEPENDENCIES})
71       FOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
72         SET(QT_USE_${depend_module}_DEPENDS 1)
73       ENDFOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
74     ELSE (QT_${module}_FOUND)
75       MESSAGE("Qt ${module} library not found.")
76     ENDIF (QT_${module}_FOUND)
77   ENDIF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
78   
79 ENDFOREACH(module)