Debian Codegraph @

cmake/modules/QtConfig.cmake

raw
1 cmake_minimum_required(VERSION 3.17.0 FATAL_ERROR)
2
3 # applies Qt specific configuration notes: For GUI applications, QtGuiConfig must be included before. This module must always
4 # be included before AppTarget/LibraryTarget.
5
6 # ensure generated sources are processed by AUTOMOC and AUTOUIC
7 if (POLICY CMP0071)
8 cmake_policy(SET CMP0071 NEW)
9 endif ()
10
11 # verify inclusion order
12 if (NOT BASIC_PROJECT_CONFIG_DONE)
13 message(FATAL_ERROR "Before including the QtConfig module, the BasicConfig module must be included.")
14 endif ()
15 if (QT_CONFIGURED)
16 message(FATAL_ERROR "The QtConfig module can not be included when Qt usage has already been configured.")
17 endif ()
18 if (TARGET_CONFIG_DONE)
19 message(FATAL_ERROR "Can not include QtConfig module when targets are already configured.")
20 endif ()
21
22 # include required modules
23 include(ListToString)
24 include(TemplateFinder)
25 include(QtLinkage)
26
27 # add the Core module as it is always required and also add additional Qt/KF modules which must have been specified before if
28 # required note: The Gui/Widgets/Quick modules should be added by including QtGuiConfig.
29 set(QT_REPOS ${ADDITIONAL_QT_REPOS} base)
30 set(QT_MODULES ${ADDITIONAL_QT_MODULES} Core)
31 set(KF_MODULES ${ADDITIONAL_KF_MODULES})
32
33 # disable auto-inclusion of QML plugins if not needed because these seem to pull in unwanted dependencies like PostgreSQL
34 # (required as of Qt 6)
35 if (NOT Quick IN_LIST QT_MODULES)
36 set(QT_SKIP_AUTO_QML_PLUGIN_INCLUSION ON)
37 endif ()
38
39 # disable deprecated features
40 option(DISABLE_DEPRECATED_QT_FEATURES "specifies whether deprecated Qt features should be disabled" OFF)
41 if (DISABLE_DEPRECATED_QT_FEATURES)
42 list(APPEND META_PRIVATE_COMPILE_DEFINITIONS QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0x060000)
43 endif ()
44
45 # allow specifying a custom directory for Qt plugins
46 set(QT_PLUGIN_DIR
47 ""
48 CACHE STRING "specifies the directory to install Qt plugins")
49
50 # check whether D-Bus interfaces need to be processed
51 if (DBUS_FILES)
52 message(STATUS "Project has D-Bus interface declarations which will be processed.")
53 # the D-Bus Qt module is required
54 list(APPEND QT_MODULES DBus)
55 endif ()
56
57 # remove duplicates
58 list(REMOVE_DUPLICATES QT_REPOS)
59 list(REMOVE_DUPLICATES QT_MODULES)
60 if (IMPORTED_QT_MODULES)
61 list(REMOVE_DUPLICATES IMPORTED_QT_MODULES)
62 endif ()
63 if (KF_MODULES)
64 list(REMOVE_DUPLICATES KF_MODULES)
65 endif ()
66 if (IMPORTED_KF_MODULES)
67 list(REMOVE_DUPLICATES IMPORTED_KF_MODULES)
68 endif ()
69
70 # find and use the required Qt/KF modules
71 set(QT_LINGUIST_TOOLS_PACKAGE "${QT_PACKAGE_PREFIX}LinguistTools")
72 set(QT_QMAKE_TARGET "${QT_PACKAGE_PREFIX}::qmake")
73 foreach (MODULE ${QT_MODULES})
74 unset(MODULE_OPTIONS)
75 if ("${MODULE}" IN_LIST META_PUBLIC_QT_MODULES)
76 list(APPEND MODULE_OPTIONS VISIBILITY PUBLIC)
77 endif ()
78 use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE "${MODULE}" ${MODULE_OPTIONS})
79 endforeach ()
80 foreach (MODULE ${KF_MODULES})
81 unset(MODULE_OPTIONS)
82 if ("${MODULE}" IN_LIST META_PUBLIC_KF_MODULES)
83 list(APPEND MODULE_OPTIONS VISIBILITY PUBLIC)
84 endif ()
85 use_qt_module(PREFIX "${KF_PACKAGE_PREFIX}" MODULE "${MODULE}" ${MODULE_OPTIONS})
86 endforeach ()
87 message(STATUS "Building ${META_TARGET_NAME} against Qt version ${${QT_PACKAGE_PREFIX}Core_VERSION}")
88
89 # remove modules which are not used after all from META_PUBLIC_…_MODULES
90 foreach (MODULE ${META_PUBLIC_QT_MODULES})
91 if (NOT "${MODULE}" IN_LIST QT_MODULES)
92 list(REMOVE_ITEM META_PUBLIC_QT_MODULES "${MODULE}")
93 endif ()
94 endforeach ()
95 foreach (MODULE ${META_PUBLIC_KF_MODULES})
96 if (NOT "${MODULE}" IN_LIST KF_MODULES)
97 list(REMOVE_ITEM META_PUBLIC_KF_MODULES "${MODULE}")
98 endif ()
99 endforeach ()
100
101 # hacks for using static Qt 5 via "StaticQt5" prefix: find regular Qt5Core module as well so Qt version is defined and use
102 # regular Qt5LinguistTools module and regular qmake target
103 if (QT_PACKAGE_PREFIX STREQUAL "StaticQt5")
104 find_package(Qt5Core)
105 set(QT_LINGUIST_TOOLS_PACKAGE Qt5LinguistTools)
106 set(QT_QMAKE_TARGET Qt5::qmake)
107 endif ()
108
109 # find transitively required Qt/KF modules
110 foreach (MODULE ${IMPORTED_QT_MODULES})
111 if (NOT "${QT_MODULE}" IN_LIST QT_MODULES)
112 find_package("${QT_PACKAGE_PREFIX}${MODULE}" REQUIRED)
113 endif ()
114 endforeach ()
115 foreach (MODULE ${IMPORTED_KF_MODULES})
116 if (NOT "${KF_MODULE}" IN_LIST KF_MODULES)
117 find_package("${KF_PACKAGE_PREFIX}${MODULE}" REQUIRED)
118 endif ()
119 endforeach ()
120
121 # enable TLS support by default when using Qt Network (relevant for linking against static plugin)
122 if (NOT DEFINED TLS_SUPPORT)
123 if (Network IN_LIST QT_MODULES OR Network IN_LIST IMPORTED_QT_MODULES)
124 set(TLS_SUPPORT ON)
125 else ()
126 set(TLS_SUPPORT OFF)
127 endif ()
128 endif ()
129
130 # allow configuring certain features when linking against static Qt
131 if (LINUX AND NOT ANDROID)
132 set(NATIVE_WAYLAND_SUPPORT_DEFAULT ON)
133 else ()
134 set(NATIVE_WAYLAND_SUPPORT_DEFAULT OFF)
135 endif ()
136 option(OPENGL_SUPPORT "whether to enable OpenGL support (when linking against static Qt)" ON)
137 option(NATIVE_WAYLAND_SUPPORT "whether to enable native Wayland support (when linking against static Qt)"
138 "${NATIVE_WAYLAND_SUPPORT_DEFAULT}")
139 option(NATIVE_WAYLAND_EGL_SUPPORT "specifies whether to enable native Wayland-EGL support (when linking against static Qt)"
140 "${NATIVE_WAYLAND_SUPPORT_DEFAULT}")
141
142 # built-in platform, imageformat and iconengine plugins when linking statically against Qt
143 if (TARGET "${QT_PACKAGE_PREFIX}::Core")
144 get_target_property(QT_TARGET_TYPE "${QT_PACKAGE_PREFIX}::Core" TYPE)
145 endif ()
146 if (STATIC_LINKAGE OR QT_TARGET_TYPE STREQUAL STATIC_LIBRARY)
147 if (META_PROJECT_IS_APPLICATION)
148 set(QT_PLUGINS_LIBRARIES_VARIABLE PRIVATE_LIBRARIES)
149 else ()
150 set(QT_PLUGINS_LIBRARIES_VARIABLE QT_TEST_LIBRARIES)
151 endif ()
152 message(
153 STATUS
154 "Linking ${META_PROJECT_NAME} (${QT_PLUGINS_LIBRARIES_VARIABLE}) against Qt plugins because static linkage is enabled or a static Qt build is used."
155 )
156
157 if (Gui IN_LIST QT_MODULES
158 OR Widgets IN_LIST QT_MODULES
159 OR Quick IN_LIST QT_MODULES)
160 if (WIN32 AND TARGET "${QT_PACKAGE_PREFIX}::QWindowsIntegrationPlugin")
161 use_qt_module(
162 LIBRARIES_VARIABLE
163 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
164 PREFIX
165 "${QT_PACKAGE_PREFIX}"
166 MODULE
167 Gui
168 PLUGINS
169 WindowsIntegration
170 ONLY_PLUGINS)
171 elseif (APPLE AND TARGET "${QT_PACKAGE_PREFIX}::QCocoaIntegrationPlugin")
172 use_qt_module(
173 LIBRARIES_VARIABLE
174 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
175 PREFIX
176 "${QT_PACKAGE_PREFIX}"
177 MODULE
178 Gui
179 PLUGINS
180 CocoaIntegration
181 ONLY_PLUGINS)
182 endif ()
183 if (EMSCRIPTEN AND TARGET "${QT_PACKAGE_PREFIX}::QWasmIntegrationPlugin")
184 use_qt_module(
185 LIBRARIES_VARIABLE
186 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
187 PREFIX
188 "${QT_PACKAGE_PREFIX}"
189 MODULE
190 Gui
191 PLUGINS
192 WasmIntegration
193 ONLY_PLUGINS)
194 endif ()
195 if (UNIX AND TARGET "${QT_PACKAGE_PREFIX}::QOffscreenIntegrationPlugin")
196 use_qt_module(
197 LIBRARIES_VARIABLE
198 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
199 PREFIX
200 "${QT_PACKAGE_PREFIX}"
201 MODULE
202 Gui
203 PLUGINS
204 OffscreenIntegration
205 ONLY_PLUGINS)
206 endif ()
207 if (TARGET "${QT_PACKAGE_PREFIX}::QXcbIntegrationPlugin")
208 use_qt_module(
209 LIBRARIES_VARIABLE
210 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
211 PREFIX
212 "${QT_PACKAGE_PREFIX}"
213 MODULE
214 Gui
215 PLUGINS
216 XcbIntegration
217 ONLY_PLUGINS)
218 endif ()
219 if (OPENGL_SUPPORT AND TARGET "${QT_PACKAGE_PREFIX}::QXcbEglIntegrationPlugin")
220 use_qt_module(
221 LIBRARIES_VARIABLE
222 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
223 PREFIX
224 "${QT_PACKAGE_PREFIX}"
225 MODULE
226 Gui
227 PLUGINS
228 XcbEglIntegration
229 ONLY_PLUGINS)
230 endif ()
231 if (OPENGL_SUPPORT AND TARGET "${QT_PACKAGE_PREFIX}::QXcbGlxIntegrationPlugin")
232 use_qt_module(
233 LIBRARIES_VARIABLE
234 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
235 PREFIX
236 "${QT_PACKAGE_PREFIX}"
237 MODULE
238 Gui
239 PLUGINS
240 XcbGlxIntegration
241 ONLY_PLUGINS)
242 endif ()
243 set(QT_CONFIG_USE_WAYLAND_INTEGRATION NO)
244 set(QT_CONFIG_WAYLAND_HAS_SEPARATE_EGL_PLUGIN NO)
245 set(QT_CONFIG_WAYLAND_CLIENT_PLUGINS WaylandXdgShellIntegration WaylandWlShellIntegration WaylandIviShellIntegration
246 WaylandQtShellIntegration)
247 if (NATIVE_WAYLAND_SUPPORT AND TARGET "${QT_PACKAGE_PREFIX}::QWaylandIntegrationPlugin")
248 use_qt_module(
249 LIBRARIES_VARIABLE
250 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
251 PREFIX
252 "${QT_PACKAGE_PREFIX}"
253 MODULE
254 Gui
255 PLUGINS
256 WaylandIntegration
257 ONLY_PLUGINS)
258 set(QT_CONFIG_USE_WAYLAND_INTEGRATION YES)
259 endif ()
260 if (NATIVE_WAYLAND_EGL_SUPPORT)
261 if (TARGET "${QT_PACKAGE_PREFIX}::QWaylandEglPlatformIntegrationPlugin")
262 use_qt_module(
263 LIBRARIES_VARIABLE
264 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
265 PREFIX
266 "${QT_PACKAGE_PREFIX}"
267 MODULE
268 Gui
269 PLUGINS
270 WaylandEglPlatformIntegration
271 ONLY_PLUGINS)
272 set(QT_CONFIG_WAYLAND_HAS_SEPARATE_EGL_PLUGIN ON)
273 endif ()
274 set(QT_CONFIG_USE_WAYLAND_INTEGRATION YES)
275 if (QT_CONFIG_WAYLAND_HAS_SEPARATE_EGL_PLUGIN OR "${${QT_PACKAGE_PREFIX}Gui_VERSION}" VERSION_GREATER_EQUAL 6.10)
276 list(APPEND QT_CONFIG_WAYLAND_CLIENT_PLUGINS WaylandEglClientBuffer)
277 endif ()
278 endif ()
279 if (QT_CONFIG_USE_WAYLAND_INTEGRATION)
280 use_qt_module(
281 LIBRARIES_VARIABLE
282 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
283 PREFIX
284 "${QT_PACKAGE_PREFIX}"
285 MODULE
286 WaylandClient
287 PLUGINS
288 ${QT_CONFIG_WAYLAND_CLIENT_PLUGINS}
289 ONLY_PLUGINS
290 PLUGINS_OPTIONAL)
291 endif ()
292 endif ()
293
294 # link against QML plugins if Qt Quick GUI is enabled
295 if (QT_MAJOR_VERSION GREATER_EQUAL 6 AND Quick IN_LIST QT_MODULES)
296 if (NOT DEFINED QT_QML_PLUGINS)
297 set(QT_QML_PLUGINS qtquick2plugin qquicklayoutsplugin qtquickdialogsplugin)
298 if (TARGET "${QT_PACKAGE_PREFIX}::labsmodelsplugin")
299 list(APPEND QT_QML_PLUGINS labsmodelsplugin)
300 endif ()
301 if (QuickControls2 IN_LIST QT_MODULES)
302 list(APPEND QT_QML_PLUGINS qtquickcontrols2plugin qmlshapesplugin effectsplugin)
303 endif ()
304 foreach (
305 CONTROLS_STYLE
306 Basic
307 Imagine
308 Material
309 Fusion
310 Windows
311 FluentWinUI3
312 Universal)
313 if ("QuickControls2${CONTROLS_STYLE}" IN_LIST QT_MODULES OR QUICK_GUI_CONTROLS_STYLE STREQUAL
314 "${CONTROLS_STYLE}")
315 string(TOLOWER "${CONTROLS_STYLE}" CONTROLS_STYLE_LOWER)
316 list(APPEND QT_QML_PLUGINS "qtquickcontrols2${CONTROLS_STYLE_LOWER}styleplugin")
317 endif ()
318 endforeach ()
319 endif ()
320 use_qt_module(
321 LIBRARIES_VARIABLE
322 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
323 PREFIX
324 "${QT_PACKAGE_PREFIX}"
325 MODULE
326 Qml
327 PLUGINS
328 ${QT_QML_PLUGINS}
329 PLUGINS_LITERAL
330 ONLY_PLUGINS)
331 endif ()
332
333 # ensure a TLS plugin is built-in when available and when creating an app using Qt Network - required since Qt 6.2.0
334 # which "pluginized" TLS support
335 if (TLS_SUPPORT)
336 set(KNOWN_TLS_PLUGINS ${META_TLS_PLUGINS} SchannelBackend TlsBackendOpenSSL)
337 set(USED_TLS_PLUGINS)
338 foreach (TLS_PLUGIN ${KNOWN_TLS_PLUGINS})
339 if (TARGET "${QT_PACKAGE_PREFIX}::Q${TLS_PLUGIN}Plugin")
340 use_qt_module(
341 LIBRARIES_VARIABLE
342 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
343 PREFIX
344 "${QT_PACKAGE_PREFIX}"
345 MODULE
346 Network
347 PLUGINS
348 ${TLS_PLUGIN}
349 ONLY_PLUGINS)
350 list(APPEND USED_TLS_PLUGINS "${TLS_PLUGIN}")
351 break() # one plugin is sufficient
352 endif ()
353 endforeach ()
354
355 # allow importing TLS plugins via qtconfig.h
356 if (USED_TLS_PLUGINS)
357 list_to_string(" " "\\\n Q_IMPORT_PLUGIN(Q" ")" "${USED_TLS_PLUGINS}" USED_TLS_PLUGINS_ARRAY)
358 elseif (${QT_PACKAGE_PREFIX}Core_VERSION VERSION_GREATER_EQUAL 6.2.0)
359 message(FATAL_ERROR "No TLS plugin could be imported but TLS_SUPPORT is enabled.")
360 endif ()
361 endif ()
362
363 # enable network information support for projects setting NETWORK_INFORMATION_SUPPORT explicitly
364 if (NETWORK_INFORMATION_SUPPORT)
365 set(KNOWN_NETWORK_INFORMATION_PLUGINS
366 ${META_NETWORK_INFORMATION_PLUGINS} NetworkManagerNetworkInformation GlibNetworkInformation NLMNI
367 AndroidNetworkInformation SCNetworkReachabilityNetworkInformation)
368 set(USED_NETWORK_INFORMATION_PLUGINS)
369 foreach (PLUGIN ${KNOWN_NETWORK_INFORMATION_PLUGINS})
370 if (TARGET "${QT_PACKAGE_PREFIX}::Q${PLUGIN}Plugin")
371 use_qt_module(
372 LIBRARIES_VARIABLE
373 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
374 PREFIX
375 "${QT_PACKAGE_PREFIX}"
376 MODULE
377 Network
378 PLUGINS
379 ${PLUGIN}
380 ONLY_PLUGINS)
381 if (PLUGIN STREQUAL NLMNI)
382 set(PLUGIN NetworkListManagerNetworkInformation)
383 endif ()
384 list(APPEND USED_NETWORK_INFORMATION_PLUGINS "${PLUGIN}")
385 endif ()
386 endforeach ()
387
388 # allow importing network information plugins via qtconfig.h
389 if (USED_NETWORK_INFORMATION_PLUGINS)
390 list_to_string(" " "\\\n Q_IMPORT_PLUGIN(Q" "BackendFactory)" "${USED_NETWORK_INFORMATION_PLUGINS}"
391 USED_NETWORK_INFORMATION_PLUGINS_ARRAY)
392 elseif (${QT_PACKAGE_PREFIX}Core_VERSION VERSION_GREATER_EQUAL 6.1.0)
393 message(
394 FATAL_ERROR "No network information plugin could be imported but NETWORK_INFORMATION_SUPPORT is enabled.")
395 endif ()
396 endif ()
397
398 # ensure all available widget style plugins are built-in when creating a Qt Widgets application - required since Qt 5.10
399 # because the styles have been "pluginized" (see commit 4f3249f)
400 set(KNOWN_WIDGET_STYLE_PLUGINS ModernWindowsStyle WindowsVistaStyle MacStyle AndroidStyle)
401 set(USED_WIDGET_STYLE_PLUGINS)
402 if (Widgets IN_LIST QT_MODULES)
403 foreach (WIDGET_STYLE_PLUGIN ${KNOWN_WIDGET_STYLE_PLUGINS})
404 if (TARGET "${QT_PACKAGE_PREFIX}::Q${WIDGET_STYLE_PLUGIN}Plugin")
405 use_qt_module(
406 LIBRARIES_VARIABLE
407 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
408 PREFIX
409 "${QT_PACKAGE_PREFIX}"
410 MODULE
411 Widgets
412 PLUGINS
413 ${WIDGET_STYLE_PLUGIN}
414 ONLY_PLUGINS)
415 list(APPEND USED_WIDGET_STYLE_PLUGINS "${WIDGET_STYLE_PLUGIN}")
416 endif ()
417 endforeach ()
418
419 # allow importing widget style plugins via qtconfig.h
420 if (USED_WIDGET_STYLE_PLUGINS)
421 list_to_string(" " "\\\n Q_IMPORT_PLUGIN(Q" "Plugin)" "${USED_WIDGET_STYLE_PLUGINS}"
422 WIDGET_STYLE_PLUGINS_ARRAY)
423 endif ()
424 endif ()
425
426 # ensure image format plugins (beside SVG) are built-in if configured
427 if (IMAGE_FORMAT_SUPPORT)
428 foreach (IMAGE_FORMAT ${IMAGE_FORMAT_SUPPORT})
429 if (IMAGE_FORMAT EQUAL "Svg")
430 # the image format plugin of the Qt Svg module is handled separately
431 set(SVG_SUPPORT ON)
432 list(REMOVE_ITEM IMAGE_FORMAT_SUPPORT Svg)
433 else ()
434 use_qt_module(
435 LIBRARIES_VARIABLE
436 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
437 PREFIX
438 "${QT_PACKAGE_PREFIX}"
439 MODULE
440 Gui
441 PLUGINS
442 ${IMAGE_FORMAT}
443 ONLY_PLUGINS)
444 endif ()
445 endforeach ()
446
447 # allow importing image format plugins via qtconfig.h
448 list_to_string(" " "\\\n Q_IMPORT_PLUGIN(Q" "Plugin)" "${IMAGE_FORMAT_SUPPORT}" IMAGE_FORMAT_SUPPORT_ARRAY)
449 endif ()
450
451 # ensure SVG plugins are built-in if configured
452 if ((SVG_SUPPORT OR SVG_ICON_SUPPORT) AND NOT Svg IN_LIST QT_MODULES)
453 use_qt_module(LIBRARIES_VARIABLE "${QT_PLUGINS_LIBRARIES_VARIABLE}" PREFIX "${QT_PACKAGE_PREFIX}" MODULE Svg)
454 endif ()
455 if (SVG_SUPPORT)
456 use_qt_module(
457 LIBRARIES_VARIABLE
458 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
459 PREFIX
460 "${QT_PACKAGE_PREFIX}"
461 MODULE
462 Svg
463 PLUGINS
464 Svg
465 ONLY_PLUGINS)
466 endif ()
467 if (SVG_ICON_SUPPORT)
468 use_qt_module(
469 LIBRARIES_VARIABLE
470 "${QT_PLUGINS_LIBRARIES_VARIABLE}"
471 PREFIX
472 "${QT_PACKAGE_PREFIX}"
473 MODULE
474 Svg
475 PLUGINS
476 SvgIcon
477 ONLY_PLUGINS)
478 endif ()
479 endif ()
480
481 # option for built-in translations
482 option(BUILTIN_TRANSLATIONS "enables/disables built-in translations when building applications and libraries" OFF)
483 option(BUILTIN_TRANSLATIONS_OF_QT "enables/disables built-in translations of Qt itself when building applications"
484 "${BUILTIN_TRANSLATIONS}")
485
486 # determine relevant Qt translation files
487 string(TOLOWER "${QT_PACKAGE_PREFIX}" QT_PACKAGE_PREFIX_LOWER)
488 set(QT_TRANSLATION_FILES)
489 set(QT_TRANSLATION_SEARCH_PATHS)
490 query_qmake_variable_path(QT_INSTALL_TRANSLATIONS)
491 if (QT_INSTALL_TRANSLATIONS)
492 list(APPEND QT_TRANSLATION_SEARCH_PATHS "${QT_INSTALL_TRANSLATIONS}")
493 endif ()
494 if (CMAKE_FIND_ROOT_PATH)
495 foreach (ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
496 list(APPEND QT_TRANSLATION_SEARCH_PATHS "${ROOT_PATH}/${CMAKE_INSTALL_DATAROOTDIR}/qt/translations"
497 "${ROOT_PATH}/${CMAKE_INSTALL_DATAROOTDIR}/${QT_PACKAGE_PREFIX_LOWER}/translations")
498 endforeach ()
499 endif ()
500 list(
501 APPEND
502 QT_TRANSLATION_SEARCH_PATHS
503 "${CMAKE_INSTALL_FULL_DATAROOTDIR}/qt/translations"
504 "${CMAKE_INSTALL_FULL_DATAROOTDIR}/${QT_PACKAGE_PREFIX_LOWER}/translations"
505 "/usr/${CMAKE_INSTALL_DATAROOTDIR}/qt/translations"
506 "/usr/${CMAKE_INSTALL_DATAROOTDIR}/${QT_PACKAGE_PREFIX_LOWER}/translations")
507 list(REMOVE_DUPLICATES QT_TRANSLATION_SEARCH_PATHS)
508 set(QT_TRANSLATIONS_FOUND NO)
509 foreach (QT_TRANSLATION_PATH ${QT_TRANSLATION_SEARCH_PATHS})
510 if (NOT IS_DIRECTORY "${QT_TRANSLATION_PATH}")
511 continue()
512 endif ()
513 foreach (QT_REPO ${QT_REPOS})
514 file(GLOB QT_QM_FILES "${QT_TRANSLATION_PATH}/qt${QT_REPO}_*.qm")
515 if (NOT QT_QM_FILES)
516 continue()
517 endif ()
518 # add files to list of built-in translations but only if that configuration is enabled and if we're building the
519 # final application
520 if (BUILTIN_TRANSLATIONS_OF_QT AND "${META_PROJECT_TYPE}" STREQUAL "application")
521 file(COPY ${QT_QM_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
522 list(APPEND EXTERNAL_QM_FILES ${QT_QM_FILES})
523 endif ()
524 list(APPEND QT_TRANSLATION_FILES "qt${QT_REPO}")
525 endforeach ()
526 set(QT_TRANSLATIONS_FOUND YES)
527 break()
528 endforeach ()
529
530 # make list of Qt translation files even if translations are not found at build time
531 if (NOT QT_TRANSLATIONS_FOUND)
532 foreach (QT_REPO ${QT_REPOS})
533 list(APPEND QT_TRANSLATION_FILES "qt${QT_REPO}")
534 endforeach ()
535 endif ()
536
537 # emit warning if no Qt translations found but built-in translations are enabled
538 if (BUILTIN_TRANSLATIONS_OF_QT AND NOT QT_TRANSLATION_FILES)
539 message(
540 WARNING
541 "Unable to find translations of Qt itself so Qt's translation files will not be built-in. Be sure Qt translations (https://code.qt.io/cgit/qt/qttranslations.git) are installed. Was looking under: ${QT_TRANSLATION_SEARCH_PATHS}"
542 )
543 endif ()
544
545 # make relevant Qt translations available as array via qtconfig.h
546 if (QT_TRANSLATION_FILES)
547 list_to_string("," " \\\n QStringLiteral(\"" "\")" "${QT_TRANSLATION_FILES}" QT_TRANSLATION_FILES_ARRAY)
548 endif ()
549
550 # enable lrelease and add install target for localization
551 option(ENABLE_QT_TRANSLATIONS "specifies whether Qt translations should be updated/released" ON)
552 if (ENABLE_QT_TRANSLATIONS AND TS_FILES)
553 message(STATUS "Project has translations which will be released.")
554 set(APP_SPECIFIC_QT_TRANSLATIONS_AVAILABLE YES)
555
556 # require the LinguistTools module (not adding it to QT_MODULES because we don't link against it)
557 find_package("${QT_LINGUIST_TOOLS_PACKAGE}")
558 if (NOT "${${QT_LINGUIST_TOOLS_PACKAGE}_FOUND}" AND QT_HOST_PATH)
559 # find the module within the host path when set (required for cross compilation with Qt 6 as the module is absent in
560 # the target install tree)
561 find_package(
562 "${QT_LINGUIST_TOOLS_PACKAGE}"
563 PATHS
564 "${QT_HOST_PATH}"
565 "${QT_HOST_PATH}/lib/cmake"
566 "/usr/lib/cmake"
567 NO_CMAKE_FIND_ROOT_PATH
568 NO_DEFAULT_PATH)
569 endif ()
570 if (NOT "${${QT_LINGUIST_TOOLS_PACKAGE}_FOUND}")
571 message(
572 FATAL_ERROR
573 "Qt translations are enabled but the CMake module \"${QT_LINGUIST_TOOLS_PACKAGE}\" could not be found.")
574 endif ()
575
576 if (NOT COMMAND qt_create_translation)
577 macro (qt_create_translation)
578 qt5_create_translation(${ARGV})
579 endmacro ()
580 endif ()
581
582 set(LUPDATE_OPTIONS
583 ""
584 CACHE STRING "specifies options passed to lupdate")
585
586 # adds the translations and a target for it
587 qt_create_translation(
588 QM_FILES
589 ${HEADER_FILES}
590 ${SRC_FILES}
591 ${WIDGETS_HEADER_FILES}
592 ${WIDGETS_SRC_FILES}
593 ${WIDGETS_UI_FILES}
594 ${QML_HEADER_FILES}
595 ${QML_SRC_FILES}
596 ${QML_RES_FILES}
597 ${EXCLUDED_FILES}
598 ${TS_FILES}
599 OPTIONS
600 ${LUPDATE_OPTIONS})
601 add_custom_target(${META_PROJECT_NAME}_translations DEPENDS ${QM_FILES})
602 if (NOT TARGET translations)
603 add_custom_target(translations DEPENDS ${META_PROJECT_NAME}_translations)
604 else ()
605 add_dependencies(translations ${META_PROJECT_NAME}_translations)
606 endif ()
607
608 # add install target for translations
609 if (NOT META_NO_INSTALL_TARGETS
610 AND ENABLE_INSTALL_TARGETS
611 AND NOT BUILTIN_TRANSLATIONS)
612 install(
613 FILES ${QM_FILES}
614 DESTINATION "${META_DATA_DIR}/translations"
615 COMPONENT localization)
616 if (NOT TARGET install-localization)
617 set(LOCALIZATION_TARGET "install-localization")
618 add_custom_target(${LOCALIZATION_TARGET} COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=localization -P
619 "${CMAKE_BINARY_DIR}/cmake_install.cmake")
620 add_dependencies(${LOCALIZATION_TARGET} ${META_PROJECT_NAME}_translations)
621 endif ()
622 endif ()
623
624 list(APPEND APP_SPECIFIC_QT_TRANSLATION_FILES "${META_PROJECT_NAME}")
625 endif ()
626
627 # make application specific translation available as array via qtconfig.h (even if this project has no translations, there
628 # might be some from dependencies)
629 if (APP_SPECIFIC_QT_TRANSLATION_FILES)
630 list_to_string("," " \\\n QStringLiteral(\"" "\")" "${APP_SPECIFIC_QT_TRANSLATION_FILES}"
631 APP_SPECIFIC_QT_TRANSLATION_FILES_ARRAY)
632 else ()
633 set(APP_SPECIFIC_QT_TRANSLATIONS_AVAILABLE NO)
634 endif ()
635
636 # built-in translations
637 if (BUILTIN_TRANSLATIONS AND (QM_FILES OR EXTERNAL_QM_FILES))
638 # write a qrc file for the qm files and add it to the resource files
639 set(TRANSLATIONS_QRC_FILE_NAME "${META_PROJECT_VARNAME_LOWER}_translations.qrc")
640 set(TRANSLATIONS_QRC_FILE "${CMAKE_CURRENT_BINARY_DIR}/${TRANSLATIONS_QRC_FILE_NAME}")
641 if (EXISTS "${TRANSLATIONS_QRC_FILE}")
642 message(STATUS "Using existing \"${TRANSLATIONS_QRC_FILE}\" for ${META_PROJECT_NAME}. "
643 "Remove this file to force re-generation of the resource file.")
644 else ()
645 file(WRITE "${TRANSLATIONS_QRC_FILE}" "<RCC><qresource prefix=\"/translations\">")
646 foreach (QM_FILE ${QM_FILES} ${EXTERNAL_QM_FILES})
647 get_filename_component(QM_FILE_NAME "${QM_FILE}" NAME)
648 file(APPEND "${TRANSLATIONS_QRC_FILE}" "<file>${QM_FILE_NAME}</file>")
649 endforeach ()
650 file(APPEND "${TRANSLATIONS_QRC_FILE}" "</qresource></RCC>")
651 endif ()
652 list(APPEND RES_FILES "${TRANSLATIONS_QRC_FILE}")
653 list(APPEND AUTOGEN_DEPS ${QM_FILES} ${EXTERNAL_QM_FILES})
654 list(APPEND BUILTIN_TRANSLATION_FILES "${TRANSLATIONS_QRC_FILE_NAME}")
655 endif ()
656
657 # generate DBus interfaces
658 if (DBUS_FILES)
659 if (NOT COMMAND qt_add_dbus_interfaces)
660 macro (qt_add_dbus_interfaces)
661 qt5_add_dbus_interfaces(${ARGV})
662 endmacro ()
663 endif ()
664 qt_add_dbus_interfaces(GENERATED_DBUS_FILES ${DBUS_FILES})
665 endif ()
666
667 # add icons to be built-in
668 if (REQUIRED_ICONS)
669 set(BUILTIN_ICON_THEMES
670 ""
671 CACHE STRING "specifies icon themes to be built-in")
672 set(BUILTIN_ICON_THEMES_SEARCH_PATH
673 ""
674 CACHE PATH "specifies the search path for icon themes to be built-in")
675 option(BUILTIN_ICON_THEMES_IN_LIBRARIES "specifies whether icon themes should also be built-in when building libraries"
676 OFF)
677 if (BUILTIN_ICON_THEMES AND (BUILTIN_ICON_THEMES_IN_LIBRARIES OR (NOT "${META_PROJECT_TYPE}" STREQUAL "library")))
678 set(BUILTIN_ICON_THEMES_QRC_FILE "${CMAKE_CURRENT_BINARY_DIR}/icons/${META_PROJECT_NAME}_builtinicons.qrc")
679 list(APPEND RES_FILES "${BUILTIN_ICON_THEMES_QRC_FILE}")
680
681 if (EXISTS "${BUILTIN_ICON_THEMES_QRC_FILE}")
682 message(
683 STATUS "Using existing \"${BUILTIN_ICON_THEMES_QRC_FILE}\" to bundle icon themes for ${META_PROJECT_NAME}. "
684 "Remove this file to force re-generation of the resource file.")
685 else ()
686 set(ICON_THEME_FILES)
687 set(ICON_SEARCH_PATHS ${BUILTIN_ICON_THEMES_SEARCH_PATH})
688
689 if (CMAKE_FIND_ROOT_PATH)
690 foreach (ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
691 list(APPEND ICON_SEARCH_PATHS "${ROOT_PATH}/${CMAKE_INSTALL_DATAROOTDIR}/icons")
692 endforeach ()
693 endif ()
694 list(APPEND ICON_SEARCH_PATHS "${CMAKE_INSTALL_FULL_DATAROOTDIR}/icons")
695 list(APPEND ICON_SEARCH_PATHS "/usr/${CMAKE_INSTALL_DATAROOTDIR}/icons") # find icons from regular prefix when
696 # cross- compiling
697 list(APPEND ICON_SEARCH_PATHS "/usr/share/icons") # the project might change CMAKE_…_DATAROOTDIR to something
698 # custom so let's add one hardcoded fallback
699
700 list(REMOVE_DUPLICATES ICON_SEARCH_PATHS)
701 set(BUILTIN_ICONS_DIR "${CMAKE_CURRENT_BINARY_DIR}/icons")
702 set(DEFAULT_THEME_INDEX_FILE "${BUILTIN_ICONS_DIR}/default/index.theme")
703 set(DEFAULT_DARK_THEME_INDEX_FILE "${BUILTIN_ICONS_DIR}/default-dark/index.theme")
704 file(REMOVE_RECURSE "${BUILTIN_ICONS_DIR}")
705 file(MAKE_DIRECTORY "${BUILTIN_ICONS_DIR}")
706 foreach (ICON_THEME ${BUILTIN_ICON_THEMES})
707 string(REGEX MATCHALL "([^:]+|[^:]+$)" ICON_THEME_PARTS "${ICON_THEME}")
708 list(LENGTH ICON_THEME_PARTS ICON_THEME_PARTS_LENGTH)
709 if ("${ICON_THEME_PARTS_LENGTH}" STREQUAL 2)
710 list(GET ICON_THEME_PARTS 0 ICON_THEME)
711 list(GET ICON_THEME_PARTS 1 NEW_ICON_THEME_NAME)
712 else ()
713 set(NEW_ICON_THEME_NAME "${ICON_THEME}")
714 endif ()
715 foreach (ICON_SEARCH_PATH ${ICON_SEARCH_PATHS})
716 set(ICON_THEME_PATH "${ICON_SEARCH_PATH}/${ICON_THEME}")
717 set(NEW_ICON_THEME_PATH "${ICON_SEARCH_PATH}/${ICON_THEME}")
718 if (IS_DIRECTORY "${ICON_THEME_PATH}")
719 message(
720 STATUS
721 "The specified icon theme \"${ICON_THEME}\" has been located under \"${ICON_THEME_PATH}\" and will be built-in."
722 )
723 # find index files
724 if (NOT ICON_THEME STREQUAL FALLBACK_ICON_THEME)
725 file(
726 GLOB GLOBBED_ICON_THEME_INDEX_FILES
727 LIST_DIRECTORIES false
728 "${ICON_THEME_PATH}/index.theme" "${ICON_THEME_PATH}/icon-theme.cache")
729 else ()
730 # only index.theme required when icons are provided as fallback anyways
731 file(
732 GLOB GLOBBED_ICON_THEME_INDEX_FILES
733 LIST_DIRECTORIES false
734 "${ICON_THEME_PATH}/index.theme")
735 endif ()
736 # make the first non-dark specified built-in theme the "default" theme make the first dark specified
737 # built-in theme the "default-dark" theme
738 if (NEW_ICON_THEME_NAME MATCHES ".*-dark" AND NOT EXISTS "${DEFAULT_DARK_THEME_INDEX_FILE}")
739 file(MAKE_DIRECTORY "${BUILTIN_ICONS_DIR}/default-dark")
740 file(WRITE "${DEFAULT_DARK_THEME_INDEX_FILE}" "[Icon Theme]\nInherits=${NEW_ICON_THEME_NAME}")
741 list(APPEND ICON_THEME_FILES "<file>default-dark/index.theme</file>")
742 elseif (NOT EXISTS "${DEFAULT_THEME_INDEX_FILE}")
743 file(MAKE_DIRECTORY "${BUILTIN_ICONS_DIR}/default")
744 file(WRITE "${DEFAULT_THEME_INDEX_FILE}" "[Icon Theme]\nInherits=${NEW_ICON_THEME_NAME}")
745 list(APPEND ICON_THEME_FILES "<file>default/index.theme</file>")
746 endif ()
747 # find required icons, except the icon theme is provided as fallback anyways
748 if (NOT ICON_THEME STREQUAL FALLBACK_ICON_THEME)
749 set(GLOB_PATTERNS)
750 foreach (REQUIRED_ICON ${REQUIRED_ICONS})
751 list(APPEND GLOB_PATTERNS "${ICON_THEME_PATH}/${REQUIRED_ICON}"
752 "${ICON_THEME_PATH}/${REQUIRED_ICON}.*" "${ICON_THEME_PATH}/*/${REQUIRED_ICON}"
753 "${ICON_THEME_PATH}/*/${REQUIRED_ICON}.*")
754 endforeach ()
755 file(
756 GLOB_RECURSE GLOBBED_ICON_THEME_FILES
757 LIST_DIRECTORIES false
758 ${GLOB_PATTERNS})
759 else ()
760 message(
761 STATUS
762 "Icon files for specified theme \"${ICON_THEME}\" are skipped because these are provided as fallback anyways."
763 )
764 set(GLOBBED_ICON_THEME_FILES)
765 endif ()
766 # make temporary copy of required icons and create resource list for Qt
767 foreach (ICON_THEME_FILE ${GLOBBED_ICON_THEME_INDEX_FILES} ${GLOBBED_ICON_THEME_FILES})
768 # skip non-existent files
769 if (NOT EXISTS "${ICON_THEME_FILE}")
770 continue()
771 endif ()
772 # resolve symlinks
773 if (IS_SYMLINK "${ICON_THEME_FILE}")
774 string(REGEX REPLACE "^${ICON_SEARCH_PATH}/" "" ICON_THEME_FILE_RELATIVE_PATH
775 "${ICON_THEME_FILE}")
776 string(REGEX REPLACE "(^[^/\\]+)" "${NEW_ICON_THEME_NAME}" NEW_ICON_THEME_FILE_RELATIVE_PATH
777 "${ICON_THEME_FILE_RELATIVE_PATH}")
778 set(ICON_THEME_FILE_ALIAS " alias=\"${NEW_ICON_THEME_FILE_RELATIVE_PATH}\"")
779 if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
780 if (CMAKE_VERSION VERSION_LESS "3.14")
781 message(FATAL_ERROR "Need at least CMake 3.14 on Windows to read symlinks of"
782 "icon theme to be bundled.")
783 endif ()
784 while (IS_SYMLINK "${ICON_THEME_FILE}")
785 get_filename_component(ICON_THEME_FILE_DIR "${ICON_THEME_FILE}" DIRECTORY)
786 file(READ_SYMLINK "${ICON_THEME_FILE}" ICON_THEME_FILE)
787 if (NOT IS_ABSOLUTE "${ICON_THEME_FILE}")
788 set(ICON_THEME_FILE "${ICON_THEME_FILE_DIR}/${ICON_THEME_FILE}")
789 endif ()
790 endwhile ()
791 endif ()
792 get_filename_component(ICON_THEME_FILE "${ICON_THEME_FILE}" REALPATH)
793 else ()
794 unset(ICON_THEME_FILE_ALIAS)
795 endif ()
796 string(REGEX REPLACE "^${ICON_SEARCH_PATH}/" "" ICON_THEME_FILE_RELATIVE_PATH
797 "${ICON_THEME_FILE}")
798 string(REGEX REPLACE "(^[^/\\]+)" "${NEW_ICON_THEME_NAME}" NEW_ICON_THEME_FILE_RELATIVE_PATH
799 "${ICON_THEME_FILE_RELATIVE_PATH}")
800 get_filename_component(ICON_THEME_FILE_DIR "${ICON_THEME_FILE_RELATIVE_PATH}" DIRECTORY)
801 string(REGEX REPLACE "(^[^/\\]+)" "${NEW_ICON_THEME_NAME}" NEW_ICON_THEME_FILE_DIR
802 "${ICON_THEME_FILE_DIR}")
803 file(MAKE_DIRECTORY "${BUILTIN_ICONS_DIR}/${NEW_ICON_THEME_FILE_DIR}")
804 file(COPY "${ICON_THEME_FILE}" DESTINATION "${BUILTIN_ICONS_DIR}/${NEW_ICON_THEME_FILE_DIR}")
805 list(APPEND ICON_THEME_FILES
806 "<file${ICON_THEME_FILE_ALIAS}>${NEW_ICON_THEME_FILE_RELATIVE_PATH}</file>")
807 endforeach ()
808 break()
809 endif ()
810 unset(ICON_THEME_PATH)
811 endforeach ()
812 if (NOT ICON_THEME_PATH)
813 message(FATAL_ERROR "The specified icon theme \"${ICON_THEME}\" could not be found.")
814 endif ()
815 endforeach ()
816 list(REMOVE_DUPLICATES ICON_THEME_FILES)
817 string(CONCAT BUILTIN_ICON_THEMES_QRC_FILE_CONTENT "<RCC><qresource prefix=\"/icons\">" ${ICON_THEME_FILES}
818 "</qresource></RCC>")
819 file(WRITE "${BUILTIN_ICON_THEMES_QRC_FILE}" "${BUILTIN_ICON_THEMES_QRC_FILE_CONTENT}")
820 endif ()
821 endif ()
822 endif ()
823
824 # export Qt resources from specified RES_FILES
825 foreach (RES_FILE ${RES_FILES})
826 get_filename_component(RES_EXT ${RES_FILE} EXT)
827 if (RES_EXT STREQUAL ".qrc")
828 get_filename_component(RES_NAME ${RES_FILE} NAME_WE)
829 list(APPEND QT_RESOURCES "${RES_NAME}")
830 endif ()
831 endforeach ()
832
833 # export Qt resources required by static libraries the static library depends on
834 if (STATIC_LIBRARIES_QT_RESOURCES)
835 list(REMOVE_DUPLICATES STATIC_LIBRARIES_QT_RESOURCES)
836 list(APPEND QT_RESOURCES ${STATIC_LIBRARIES_QT_RESOURCES})
837 endif ()
838
839 # enable Qt resources required by libraries the application depends on
840 if (QT_RESOURCES)
841 list(REMOVE_DUPLICATES QT_RESOURCES)
842
843 # make enabling resources of static dependencies available via qtconfig.h
844 unset(ENABLE_QT_RESOURCES_OF_STATIC_DEPENDENCIES)
845 foreach (QT_RESOURCE ${STATIC_LIBRARIES_QT_RESOURCES})
846 set(ENABLE_QT_RESOURCES_OF_STATIC_DEPENDENCIES
847 "${ENABLE_QT_RESOURCES_OF_STATIC_DEPENDENCIES} \\\n struct initializer_${QT_RESOURCE} { \\\n initializer_${QT_RESOURCE}() { Q_INIT_RESOURCE(${QT_RESOURCE}); } \\\n ~initializer_${QT_RESOURCE}() { Q_CLEANUP_RESOURCE(${QT_RESOURCE}); } \\\n } dummy_${QT_RESOURCE};"
848 )
849 endforeach ()
850 endif ()
851
852 # enable moc, uic and rcc by default for all targets
853 set(CMAKE_AUTOMOC ON)
854 set(CMAKE_AUTORCC ON)
855 set(CMAKE_INCLUDE_CURRENT_DIR ON)
856 if (WIDGETS_UI_FILES AND WIDGETS_GUI)
857 set(CMAKE_AUTOUIC ON)
858 if (INSTALL_UI_HEADER)
859 # also add install for header files generated by uic
860 foreach (UI_FILE WIDGETS_UI_FILES)
861 get_filename_component(UI_NAME "${UI_FILE}" NAME_WE)
862 install(
863 FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_${UI_NAME}.h"
864 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${META_PROJECT_NAME}/ui"
865 COMPONENT ui-header)
866 endforeach ()
867 endif ()
868 endif ()
869
870 # avoid treating certain warnings as errors when compiling generated files
871 function (configure_development_warnings_for_qt)
872 set(OPTIONAL_ARGS)
873 set(ONE_VALUE_ARGS TARGET)
874 set(MULTI_VALUE_ARGS AUTOGEN_SOURCES)
875 cmake_parse_arguments(ARGS "${OPTIONAL_ARGS}" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN})
876
877 if (NOT ENABLE_WARNINGS OR NOT (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
878 return() # no problematic warnings are configured anyway via configure_development_warnings()
879 endif ()
880 if (${QT_PACKAGE_PREFIX}Core_VERSION VERSION_LESS 6.11.0)
881 return() # no problematic warnings to deal with before Qt 6.11.0
882 endif ()
883
884 # workaround sign conversion warning present in files generated by moc as of Qt 6.11.0
885 list(APPEND COMPILE_OPTIONS_TO_CONFIGURE_FOR_AUTOGEN_SOURCES "-Wno-sign-conversion")
886
887 # apply compiler options to relevant source files
888 if (ARGS_TARGET)
889 list(APPEND ARGS_AUTOGEN_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_TARGET}_autogen/mocs_compilation.cpp")
890 endif ()
891 if (ARGS_AUTOGEN_SOURCES)
892 message(STATUS "autogen src ${ARGS_TARGET}: ${ARGS_AUTOGEN_SOURCES}")
893 endif ()
894 set_property(
895 SOURCE ${ARGS_AUTOGEN_SOURCES}
896 APPEND
897 PROPERTY COMPILE_OPTIONS "${COMPILE_OPTIONS_TO_CONFIGURE_FOR_AUTOGEN_SOURCES}")
898 endfunction ()
899 configure_development_warnings_for_qt(TARGET "${META_TARGET_NAME}" AUTOGEN_SOURCES "${GENERATED_DBUS_FILES}")
900
901 # add configuration header for Qt-specific configuration
902 find_template_file("qtconfig.h" QT_UTILITIES QT_CONFIG_H_TEMPLATE_FILE)
903 configure_file("${QT_CONFIG_H_TEMPLATE_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/resources/qtconfig.h")
904
905 set(QT_CONFIGURED YES)