Introduce "generator expressions" to add_test()
[cmake.git] / Modules / UseQt4.cmake
blobd8b3756c347a4984911327ddf0b8aa6ba7019ea6
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)
56 SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE)
58 # Qt modules  (in order of dependence)
59 FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
60                QAXSERVER QAXCONTAINER QTSCRIPT QTSVG QTUITOOLS QTHELP 
61                QTWEBKIT PHONON QTSCRIPTTOOLS QTGUI QTTEST QTDBUS QTXML QTSQL 
62                QTXMLPATTERNS QTNETWORK QTCORE)
64   IF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
65     IF (QT_${module}_FOUND)
66       IF(QT_USE_${module})
67         STRING(REPLACE "QT" "" qt_module_def "${module}")
68         ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB)
69         INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR})
70       ENDIF(QT_USE_${module})
71       SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY} ${QT_${module}_LIB_DEPENDENCIES})
72       FOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
73         SET(QT_USE_${depend_module}_DEPENDS 1)
74       ENDFOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
75     ELSE (QT_${module}_FOUND)
76       MESSAGE("Qt ${module} library not found.")
77     ENDIF (QT_${module}_FOUND)
78   ENDIF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
79   
80 ENDFOREACH(module)