| 1 | set(QT_MIN_VERSION 4.2.0) |
|---|
| 2 | |
|---|
| 3 | if (NOT QT4_FOUND) |
|---|
| 4 | find_package(Qt4 REQUIRED) |
|---|
| 5 | endif (NOT QT4_FOUND) |
|---|
| 6 | |
|---|
| 7 | ow_create_project(qt4) |
|---|
| 8 | |
|---|
| 9 | ow_add_public_include_dirs( |
|---|
| 10 | ${QT_INCLUDE_DIR} |
|---|
| 11 | ${QT_INCLUDE_DIR}/Qt |
|---|
| 12 | ${QT_INCLUDE_DIR}/QtCore |
|---|
| 13 | ) |
|---|
| 14 | |
|---|
| 15 | # see http://www.cmake.org/pipermail/cmake/2005-August/007149.html |
|---|
| 16 | file(TO_CMAKE_PATH ${QT_LIBRARY_DIR} QT_LIBRARY_DIR) |
|---|
| 17 | |
|---|
| 18 | ow_add_public_library_dirs( |
|---|
| 19 | ${QT_LIBRARY_DIR} |
|---|
| 20 | ) |
|---|
| 21 | |
|---|
| 22 | if (CMAKE_BUILD_TYPE MATCHES Debug) |
|---|
| 23 | if(NOT QT_QTWEBKIT_LIBRARY_DEBUG) |
|---|
| 24 | message(FATAL_ERROR "Qt webkit debug is not installed") |
|---|
| 25 | endif() |
|---|
| 26 | |
|---|
| 27 | ow_add_public_libraries( |
|---|
| 28 | ${QT_QTCORE_LIBRARY_DEBUG} |
|---|
| 29 | ${QT_QTGUI_LIBRARY_DEBUG} |
|---|
| 30 | ${QT_QTNETWORK_LIBRARY_DEBUG} |
|---|
| 31 | ${QT_QTXML_LIBRARY_DEBUG} |
|---|
| 32 | ${QT_QTSVG_LIBRARY_DEBUG} |
|---|
| 33 | ${QT_QTWEBKIT_LIBRARY_DEBUG} |
|---|
| 34 | ) |
|---|
| 35 | if (UNIX) |
|---|
| 36 | ow_add_public_libraries( |
|---|
| 37 | ${QT_QTDBUS_LIBRARY_DEBUG} |
|---|
| 38 | ) |
|---|
| 39 | if (QT_QTUITOOLS_LIBRARY_DEBUG) |
|---|
| 40 | ow_add_public_libraries( |
|---|
| 41 | ${QT_QTUITOOLS_LIBRARY_DEBUG} |
|---|
| 42 | ) |
|---|
| 43 | else (QT_QTUITOOLS_LIBRARY_DEBUG) |
|---|
| 44 | if (QT_QTUITOOLS_LIBRARY_RELEASE) |
|---|
| 45 | ow_add_public_libraries( |
|---|
| 46 | ${QT_QTUITOOLS_LIBRARY_RELEASE} |
|---|
| 47 | ) |
|---|
| 48 | else (QT_QTUITOOLS_LIBRARY_RELEASE) |
|---|
| 49 | ow_add_public_libraries( |
|---|
| 50 | QtUiTools |
|---|
| 51 | ) |
|---|
| 52 | endif (QT_QTUITOOLS_LIBRARY_RELEASE) |
|---|
| 53 | endif (QT_QTUITOOLS_LIBRARY_DEBUG) |
|---|
| 54 | else (UNIX) |
|---|
| 55 | ow_add_public_libraries( |
|---|
| 56 | QtUiToolsd |
|---|
| 57 | ) |
|---|
| 58 | |
|---|
| 59 | find_library( |
|---|
| 60 | QT_QTAXCONTAINER_LIBRARY_DEBUG |
|---|
| 61 | NAMES |
|---|
| 62 | QAxContainerd |
|---|
| 63 | PATHS |
|---|
| 64 | ${QT_LIBRARY_DIR} |
|---|
| 65 | ) |
|---|
| 66 | if (QT_QTAXCONTAINER_LIBRARY_DEBUG) |
|---|
| 67 | message(STATUS "Qt4 with ActiveX (QAxContainer) support on") |
|---|
| 68 | ow_add_public_libraries( |
|---|
| 69 | ${QT_QTAXCONTAINER_LIBRARY_DEBUG} |
|---|
| 70 | ) |
|---|
| 71 | else (QT_QTAXCONTAINER_LIBRARY_DEBUG) |
|---|
| 72 | message(STATUS "Qt4 with ActiveX (QAxContainer) support off") |
|---|
| 73 | endif (QT_QTAXCONTAINER_LIBRARY_DEBUG) |
|---|
| 74 | endif (UNIX) |
|---|
| 75 | else (CMAKE_BUILD_TYPE MATCHES Debug) |
|---|
| 76 | if(NOT QT_QTWEBKIT_LIBRARY) |
|---|
| 77 | message(FATAL_ERROR "Qt webkit is not installed") |
|---|
| 78 | endif() |
|---|
| 79 | ow_add_public_libraries( |
|---|
| 80 | ${QT_QTCORE_LIBRARY_RELEASE} |
|---|
| 81 | ${QT_QTGUI_LIBRARY_RELEASE} |
|---|
| 82 | ${QT_QTNETWORK_LIBRARY_RELEASE} |
|---|
| 83 | ${QT_QTXML_LIBRARY_RELEASE} |
|---|
| 84 | ${QT_QTSVG_LIBRARY_RELEASE} |
|---|
| 85 | ${QT_QTWEBKIT_LIBRARY_RELEASE} |
|---|
| 86 | QtUiTools |
|---|
| 87 | ) |
|---|
| 88 | if (UNIX) |
|---|
| 89 | ow_add_public_libraries( |
|---|
| 90 | ${QT_QTDBUS_LIBRARY_RELEASE} |
|---|
| 91 | ) |
|---|
| 92 | endif (UNIX) |
|---|
| 93 | if (WIN32) |
|---|
| 94 | find_library( |
|---|
| 95 | QT_QTAXCONTAINER_LIBRARY_RELEASE |
|---|
| 96 | NAMES |
|---|
| 97 | QAxContainer |
|---|
| 98 | PATHS |
|---|
| 99 | ${QT_LIBRARY_DIR} |
|---|
| 100 | ) |
|---|
| 101 | |
|---|
| 102 | if (QT_QTAXCONTAINER_LIBRARY_RELEASE) |
|---|
| 103 | message(STATUS "Qt4 with ActiveX (QAxContainer) support on") |
|---|
| 104 | ow_add_public_libraries( |
|---|
| 105 | ${QT_QTAXCONTAINER_LIBRARY_RELEASE} |
|---|
| 106 | ) |
|---|
| 107 | else (QT_QTAXCONTAINER_LIBRARY_RELEASE) |
|---|
| 108 | message(STATUS "Qt4 with ActiveX (QAxContainer) support off") |
|---|
| 109 | endif (QT_QTAXCONTAINER_LIBRARY_RELEASE) |
|---|
| 110 | endif (WIN32) |
|---|
| 111 | endif (CMAKE_BUILD_TYPE MATCHES Debug) |
|---|
| 112 | |
|---|
| 113 | ow_add_public_definitions( |
|---|
| 114 | -DQT_DLL |
|---|
| 115 | -DQT_NO_KEYWORDS |
|---|
| 116 | ) |
|---|
| 117 | |
|---|
| 118 | if (MSVC) |
|---|
| 119 | file(TO_CMAKE_PATH $ENV{QTDIR} QTDIR) |
|---|
| 120 | file(TO_CMAKE_PATH ${QT_PLUGINS_DIR} QT_PLUGINS_DIR) |
|---|
| 121 | |
|---|
| 122 | file(MAKE_DIRECTORY ${BUILD_DIR}/imageformats/ ) |
|---|
| 123 | |
|---|
| 124 | if (CMAKE_BUILD_TYPE MATCHES Debug) |
|---|
| 125 | ow_copy_file(${QTDIR}/bin/QtCored4.dll ${BUILD_DIR}) |
|---|
| 126 | ow_copy_file(${QTDIR}/bin/QtGuid4.dll ${BUILD_DIR}) |
|---|
| 127 | ow_copy_file(${QTDIR}/bin/QtNetworkd4.dll ${BUILD_DIR}) |
|---|
| 128 | ow_copy_file(${QTDIR}/bin/QtXmld4.dll ${BUILD_DIR}) |
|---|
| 129 | ow_copy_file(${QTDIR}/bin/QtSvgd4.dll ${BUILD_DIR}) |
|---|
| 130 | ow_copy_file(${QTDIR}/bin/QtWebKitd4.dll ${BUILD_DIR}) |
|---|
| 131 | ow_copy_file(${QTDIR}/bin/phonond4.dll ${BUILD_DIR}) |
|---|
| 132 | |
|---|
| 133 | #if(MSVC80) |
|---|
| 134 | # ow_copy_file(${QTDIR}/plugins/imageformats/qgifd4.dll.manifest ${BUILD_DIR}/imageformats/) |
|---|
| 135 | # ow_copy_file(${QTDIR}/plugins/imageformats/qjpegd4.dll.manifest ${BUILD_DIR}/imageformats/) |
|---|
| 136 | # ow_copy_file(${QTDIR}/plugins/imageformats/qmngd4.dll.manifest ${BUILD_DIR}/imageformats/) |
|---|
| 137 | # ow_copy_file(${QTDIR}/plugins/imageformats/qsvgd4.dll.manifest ${BUILD_DIR}/imageformats/) |
|---|
| 138 | # ow_copy_file(${QTDIR}/plugins/imageformats/qtiffd4.dll.manifest ${BUILD_DIR}/imageformats/) |
|---|
| 139 | #endif(MSVC80) |
|---|
| 140 | |
|---|
| 141 | ow_copy_file(${QTDIR}/plugins/imageformats/qgifd4.dll ${BUILD_DIR}/imageformats/) |
|---|
| 142 | ow_copy_file(${QTDIR}/plugins/imageformats/qjpegd4.dll ${BUILD_DIR}/imageformats/) |
|---|
| 143 | ow_copy_file(${QTDIR}/plugins/imageformats/qmngd4.dll ${BUILD_DIR}/imageformats/) |
|---|
| 144 | ow_copy_file(${QTDIR}/plugins/imageformats/qsvgd4.dll ${BUILD_DIR}/imageformats/) |
|---|
| 145 | ow_copy_file(${QTDIR}/plugins/imageformats/qtiffd4.dll ${BUILD_DIR}/imageformats/) |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | else (CMAKE_BUILD_TYPE MATCHES Debug) |
|---|
| 149 | ow_copy_file(${QTDIR}/bin/QtCore4.dll ${BUILD_DIR}) |
|---|
| 150 | ow_copy_file(${QTDIR}/bin/QtGui4.dll ${BUILD_DIR}) |
|---|
| 151 | ow_copy_file(${QTDIR}/bin/QtNetwork4.dll ${BUILD_DIR}) |
|---|
| 152 | ow_copy_file(${QTDIR}/bin/QtXml4.dll ${BUILD_DIR}) |
|---|
| 153 | ow_copy_file(${QTDIR}/bin/QtSvg4.dll ${BUILD_DIR}) |
|---|
| 154 | ow_copy_file(${QTDIR}/bin/QtWebKit4.dll ${BUILD_DIR}) |
|---|
| 155 | ow_copy_file(${QTDIR}/bin/phonon4.dll ${BUILD_DIR}) |
|---|
| 156 | |
|---|
| 157 | ow_copy_file(${QTDIR}/plugins/imageformats/qgif4.dll ${BUILD_DIR}/imageformats/) |
|---|
| 158 | ow_copy_file(${QTDIR}/plugins/imageformats/qjpeg4.dll ${BUILD_DIR}/imageformats/) |
|---|
| 159 | ow_copy_file(${QTDIR}/plugins/imageformats/qmng4.dll ${BUILD_DIR}/imageformats/) |
|---|
| 160 | ow_copy_file(${QTDIR}/plugins/imageformats/qsvg4.dll ${BUILD_DIR}/imageformats/) |
|---|
| 161 | ow_copy_file(${QTDIR}/plugins/imageformats/qtiff4.dll ${BUILD_DIR}/imageformats/) |
|---|
| 162 | |
|---|
| 163 | #if(MSVC80) |
|---|
| 164 | # ow_copy_file(${QTDIR}/plugins/imageformats/qgif4.dll.manifest ${BUILD_DIR}/imageformats/) |
|---|
| 165 | # ow_copy_file(${QTDIR}/plugins/imageformats/qjpeg4.dll.manifest ${BUILD_DIR}/imageformats/) |
|---|
| 166 | # ow_copy_file(${QTDIR}/plugins/imageformats/qmng4.dll.manifest ${BUILD_DIR}/imageformats/) |
|---|
| 167 | # ow_copy_file(${QTDIR}/plugins/imageformats/qsvg4.dll.manifest ${BUILD_DIR}/imageformats/) |
|---|
| 168 | # ow_copy_file(${QTDIR}/plugins/imageformats/qtiff4.dll.manifest ${BUILD_DIR}/imageformats/) |
|---|
| 169 | #endif(MSVC80) |
|---|
| 170 | |
|---|
| 171 | endif (CMAKE_BUILD_TYPE MATCHES Debug) |
|---|
| 172 | endif (MSVC) |
|---|
| 173 | |
|---|
| 174 | if (APPLE) |
|---|
| 175 | ow_copy_dir_recursive(/Developer/Applications/Qt/plugins/imageformats/* ${BUILD_DIR}/QuteCom.app/Contents/plugins/imageformats/.) |
|---|
| 176 | ow_copy_dir_recursive(/Developer/Applications/Qt/plugins/codecs/* ${BUILD_DIR}/QuteCom.app/Contents/plugins/codecs/.) |
|---|
| 177 | endif (APPLE) |
|---|
| 178 | |
|---|
| 179 | if (LINUX) |
|---|
| 180 | if (CMAKE_BUILD_TYPE MATCHES Debug) |
|---|
| 181 | set(suffix "_debug") |
|---|
| 182 | else (CMAKE_BUILD_TYPE MATCHES Debug) |
|---|
| 183 | set(suffix "") |
|---|
| 184 | endif (CMAKE_BUILD_TYPE MATCHES Debug) |
|---|
| 185 | |
|---|
| 186 | file(GLOB plugin_list "${QT_PLUGINS_DIR}/imageformats/*${suffix}.so") |
|---|
| 187 | foreach(plugin_path ${plugin_list}) |
|---|
| 188 | get_filename_component(plugin_name "${plugin_path}" NAME) |
|---|
| 189 | ow_copy_file(${plugin_path} ${BUILD_DIR}/imageformats/${plugin_name}) |
|---|
| 190 | endforeach(plugin_path) |
|---|
| 191 | endif (LINUX) |
|---|
| 192 | |
|---|
| 193 | IF(QT_QCONFIG MATCHES "glib") |
|---|
| 194 | set(QT_WITH_GLIB |
|---|
| 195 | TRUE |
|---|
| 196 | CACHE INTERNAL "QT with glib event loop" |
|---|
| 197 | ) |
|---|
| 198 | ENDIF(QT_QCONFIG MATCHES "glib") |
|---|
| 199 | |
|---|
| 200 | # Copy Qt translations |
|---|
| 201 | exec_program(${QT_QMAKE_EXECUTABLE} |
|---|
| 202 | ARGS "-query QT_INSTALL_TRANSLATIONS" |
|---|
| 203 | OUTPUT_VARIABLE QT_INSTALL_TRANSLATIONS) |
|---|
| 204 | |
|---|
| 205 | file(TO_CMAKE_PATH ${QT_INSTALL_TRANSLATIONS} QT_INSTALL_TRANSLATIONS) |
|---|
| 206 | |
|---|
| 207 | ow_copy_dir(${QT_INSTALL_TRANSLATIONS}/*.qm ${LOCALE_COPY_DIR}/.) |
|---|