1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
|
From 4f73d89a04a21b0f8b27acb56367356c78c78f0a Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Sat, 5 Aug 2017 21:14:26 +0200
Subject: [PATCH 21/32] Allow usage of static version with CMake
Allow selecting between dynamic and static Qt versions
installed in the same prefix
- Use eg. find_package(Qt5Core) for dynamic version
- and eg. find_package(StaticQt5Core) for static version
- Static targets are prefixed, eg. StaticQt5::Core
- Set USE_STATIC_QT_BY_DEFAULT to use static version
via regular find_package(Qt5Core)
Change-Id: I410d22d1bee9dd66b90e07461c85fdb74ef621c1
---
mkspecs/features/create_cmake.prf | 96 ++++--
.../data/cmake/Qt5BasicConfig.cmake.in | 311 +++++++++++-------
.../data/cmake/Qt5PluginTarget.cmake.in | 30 +-
.../cmake/Qt5StaticOnlyRedirection.cmake.in | 11 +
src/corelib/Qt5CoreConfigExtras.cmake.in | 26 +-
src/gui/Qt5GuiConfigExtras.cmake.in | 8 +-
src/testlib/Qt5TestConfigExtras.cmake.in | 2 +-
7 files changed, 318 insertions(+), 166 deletions(-)
create mode 100644 mkspecs/features/data/cmake/Qt5StaticOnlyRedirection.cmake.in
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index ac089a2f9f0..ceae7c1f8c6 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -68,7 +68,7 @@ split_incpath {
$$QT_MODULE_INCLUDE_BASE/$${CMAKE_INCLUDE_NAME}/$$eval(QT.$${MODULE}.VERSION)/$${CMAKE_INCLUDE_NAME})
cmake_extra_source_includes.input = $$PWD/data/cmake/ExtraSourceIncludes.cmake.in
- cmake_extra_source_includes.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/ExtraSourceIncludes.cmake
+ cmake_extra_source_includes.output = $$CMAKE_OUT_DIR/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/ExtraSourceIncludes.cmake
!build_pass:QMAKE_SUBSTITUTES += \
cmake_extra_source_includes
@@ -118,6 +118,8 @@ win32:!static:!staticlib {
}
static|staticlib:CMAKE_STATIC_TYPE = true
+static|staticlib:DEFAULT_QT_VARIANT_PREFIX = "Static"
+else:DEFAULT_QT_VARIANT_PREFIX = ""
internal_module {
CMAKE_INTERNAL_MODULE = true
@@ -221,20 +223,25 @@ contains(CONFIG, plugin) {
win32 {
!mingw|qtConfig(debug_and_release): debug_suffix="d"
- CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
- CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}$${debug_suffix}.prl
-
- isEmpty(CMAKE_STATIC_TYPE) {
+ mingw {
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.dll
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}$${debug_suffix}.dll
- } else:mingw {
- CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.a
- CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}$${debug_suffix}.a
+ CMAKE_PLUGIN_LOCATION_RELEASE_STATIC = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.a
+ CMAKE_PLUGIN_LOCATION_DEBUG_STATIC = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}$${debug_suffix}.a
+ CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
+ CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}$${debug_suffix}.prl
+ CMAKE_PRL_FILE_LOCATION_RELEASE_STATIC = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.static.prl
+ CMAKE_PRL_FILE_LOCATION_DEBUG_STATIC = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}$${debug_suffix}.static.prl
} else { # MSVC static
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.lib
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}$${debug_suffix}.lib
+ CMAKE_PLUGIN_LOCATION_RELEASE_STATIC = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.lib
+ CMAKE_PLUGIN_LOCATION_DEBUG_STATIC = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}$${debug_suffix}.lib
+ CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
+ CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}$${debug_suffix}.prl
}
} else {
+ # this branch is broken by the patch, only apply when building for Windows
mac {
isEmpty(CMAKE_STATIC_TYPE): CMAKE_PLUGIN_EXT = .dylib
else: CMAKE_PLUGIN_EXT = .a
@@ -254,9 +261,9 @@ contains(CONFIG, plugin) {
}
}
cmake_target_file.input = $$PWD/data/cmake/Qt5PluginTarget.cmake.in
- cmake_target_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}_$${PLUGIN_CLASS_NAME}.cmake
+ cmake_target_file.output = $$CMAKE_OUT_DIR/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_$${PLUGIN_CLASS_NAME}.cmake
cmake_qt5_plugin_import_file.input = $$PWD/data/cmake/Qt5ImportPlugin.cpp.in
- cmake_qt5_plugin_import_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}_$${PLUGIN_CLASS_NAME}_Import.cpp
+ cmake_qt5_plugin_import_file.output = $$CMAKE_OUT_DIR/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}_$${PLUGIN_CLASS_NAME}_Import.cpp
!build_pass {
QMAKE_SUBSTITUTES += cmake_target_file
@@ -265,7 +272,7 @@ contains(CONFIG, plugin) {
cmake_qt5_plugin_file.files = $$cmake_target_file.output
static|staticlib: cmake_qt5_plugin_file.files += $$cmake_qt5_plugin_import_file.output
- cmake_qt5_plugin_file.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
+ cmake_qt5_plugin_file.path = $$[QT_INSTALL_LIBS]/cmake/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}
INSTALLS += cmake_qt5_plugin_file
return()
@@ -278,30 +285,38 @@ mod_deps =
lib_deps =
aux_mod_deps =
aux_lib_deps =
+aux_compile_defs_static = QT_STATIC QT_DESIGNER_STATIC
+contains(QT_CONFIG, angle): aux_compile_defs += QT_OPENGL_ES_2_ANGLE_STATIC
# Until CMake 3.0 is the minimum requirement of Qt 5, we need to filter
# out header-only modules from dependencies. CMake 3.0 provides INTERFACE
# libraries which are equivalent to header-only modules.
for (dep, sorted_deps) {
cdep = $$cmakeModuleName($$dep)
!contains(QT.$${dep}.module_config, no_link) {
- mod_deps += $$cdep
- lib_deps += Qt5::$$cdep
+ mod_deps += "$$cdep"
+ lib_deps += "${QT_VARIANT_PREFIX}Qt5::$$cdep"
+ lib_deps_static += "${QT_VARIANT_PREFIX}Qt5::$$cdep"
} else {
- aux_mod_deps += $$cdep
- aux_lib_deps += Qt5::$$cdep
+ aux_mod_deps += "$$cdep"
+ aux_lib_deps += "${QT_VARIANT_PREFIX}Qt5::$$cdep"
+ aux_lib_deps_static += "${QT_VARIANT_PREFIX}Qt5::$$cdep"
}
}
CMAKE_MODULE_DEPS = $$join(mod_deps, ";")
CMAKE_QT5_MODULE_DEPS = $$join(lib_deps, ";")
+CMAKE_QT5_MODULE_DEPS_STATIC = $$join(lib_deps_static, ";")
CMAKE_INTERFACE_MODULE_DEPS = $$join(aux_mod_deps, ";")
CMAKE_INTERFACE_QT5_MODULE_DEPS = $$join(aux_lib_deps, ";")
CMAKE_MODULE_PLUGIN_TYPES = $$join(QT.$${MODULE}.plugin_types, ";")
+CMAKE_INTERFACE_QT5_MODULE_DEPS_STATIC = $$join(aux_lib_deps_static, ";")
+CMAKE_INTERFACE_COMPILE_DEFINITIONS_STATIC = $$join(aux_compile_defs_static, ";")
# Interface libraries have to have all properties starting with "INTERFACE_".
CMAKE_FEATURE_PROPERTY_PREFIX = ""
equals(TEMPLATE, aux): CMAKE_FEATURE_PROPERTY_PREFIX = "INTERFACE_"
mac {
+ # this branch is broken by the patch, only apply when building for Windows
!isEmpty(CMAKE_STATIC_TYPE) {
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.a
CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
@@ -328,13 +343,6 @@ mac {
CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}$${debug_suffix}.dll
CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.dll
- !isEmpty(CMAKE_STATIC_TYPE) {
- CMAKE_STATIC_WINDOWS_BUILD = "true"
-
- CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}$${debug_suffix}.prl
- CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
- }
-
mingw {
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqt5main$${QT_LIBINFIX}$${debug_suffix}.a
CMAKE_WINMAIN_FILE_LOCATION_RELEASE = libqt5main$${QT_LIBINFIX}.a
@@ -342,14 +350,30 @@ mac {
isEmpty(QMAKE_EXTENSION_IMPORTLIB): QMAKE_EXTENSION_IMPORTLIB = a
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}$${debug_suffix}.$${QMAKE_EXTENSION_IMPORTLIB}
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.$${QMAKE_EXTENSION_IMPORTLIB}
+ CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}$${debug_suffix}.prl
+ CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
+
+ CMAKE_IMPLIB_FILE_LOCATION_DEBUG_STATIC = lib$${CMAKE_QT_STEM}$${debug_suffix}.a
+ CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC = lib$${CMAKE_QT_STEM}.a
+ CMAKE_PRL_FILE_LOCATION_DEBUG_STATIC = $${CMAKE_QT_STEM}$${debug_suffix}.static.prl
+ CMAKE_PRL_FILE_LOCATION_RELEASE_STATIC = $${CMAKE_QT_STEM}.static.prl
+
} else {
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qt5main$${QT_LIBINFIX}$${debug_suffix}.lib
CMAKE_WINMAIN_FILE_LOCATION_RELEASE = qt5main$${QT_LIBINFIX}.lib
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}$${debug_suffix}.lib
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
+ CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}$${debug_suffix}.prl
+ CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
+
+ CMAKE_IMPLIB_FILE_LOCATION_DEBUG_STATIC = $${CMAKE_QT_STEM}$${debug_suffix}.lib
+ CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC = $${CMAKE_QT_STEM}.lib
+ CMAKE_PRL_FILE_LOCATION_DEBUG_STATIC = $${CMAKE_QT_STEM}$${debug_suffix}.static.prl
+ CMAKE_PRL_FILE_LOCATION_RELEASE_STATIC = $${CMAKE_QT_STEM}.static.prl
}
} else {
+ # this branch is broken by the patch, only apply when building for Windows
!isEmpty(CMAKE_STATIC_TYPE) {
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.a
CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
@@ -369,12 +393,12 @@ mac {
INSTALLS += cmake_qt5_module_files
cmake_config_file.input = $$PWD/data/cmake/Qt5BasicConfig.cmake.in
-cmake_config_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}Config.cmake
+cmake_config_file.output = $$CMAKE_OUT_DIR/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}Config.cmake
CMAKE_PACKAGE_VERSION = $$eval(QT.$${MODULE}.VERSION)
cmake_config_version_file.input = $$PWD/data/cmake/Qt5ConfigVersion.cmake.in
-cmake_config_version_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}ConfigVersion.cmake
+cmake_config_version_file.output = $$CMAKE_OUT_DIR/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}ConfigVersion.cmake
!build_pass:QMAKE_SUBSTITUTES += \
cmake_config_file \
@@ -384,11 +408,29 @@ cmake_qt5_module_files.files = \
$$cmake_config_file.output \
$$cmake_config_version_file.output
+# add regular CMake package for static-only modules
+static|staticlib:actually_a_shared_build {
+ INSTALLS += cmake_qt5_module_files_shared
+
+ cmake_config_file_shared.input = $$PWD/data/cmake/Qt5StaticOnlyRedirection.cmake.in
+ cmake_config_file_shared.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}Config.cmake
+ cmake_config_version_file_shared.input = $$PWD/data/cmake/Qt5ConfigVersion.cmake.in
+ cmake_config_version_file_shared.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}ConfigVersion.cmake
+ !build_pass:QMAKE_SUBSTITUTES += \
+ cmake_config_file_shared \
+ cmake_config_version_file_shared
+
+ cmake_qt5_module_files_shared.files = \
+ $$cmake_config_file_shared.output \
+ $$cmake_config_version_file_shared.output
+ cmake_qt5_module_files_shared.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
+}
+
cmake_extras_file.input = $$_PRO_FILE_PWD_/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake.in
exists($$cmake_extras_file.input) {
CMAKE_MODULE_EXTRAS = "true"
- cmake_extras_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake
+ cmake_extras_file.output = $$CMAKE_OUT_DIR/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake
!build_pass:QMAKE_SUBSTITUTES += cmake_extras_file
@@ -400,7 +442,7 @@ cmake_macros_file.input = $$_PRO_FILE_PWD_/Qt5$${CMAKE_MODULE_NAME}Macros.cmake
exists($$cmake_macros_file.input) {
CMAKE_MODULE_MACROS = "true"
- cmake_macros_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}Macros.cmake
+ cmake_macros_file.output = $$CMAKE_OUT_DIR/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}Macros.cmake
cmake_macros_file.CONFIG = verbatim
!build_pass:QMAKE_SUBSTITUTES += cmake_macros_file
@@ -408,7 +450,7 @@ exists($$cmake_macros_file.input) {
cmake_qt5_module_files.files += $$cmake_macros_file.output
}
-cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
+cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/$${DEFAULT_QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}
# We are generating cmake files. Most developers of Qt are not aware of cmake,
# so we require automatic tests to be available. The only module which should
diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
index 5a5bc4d61d6..97150fb2448 100644
--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
@@ -2,6 +2,33 @@ if (CMAKE_VERSION VERSION_LESS 3.1.0)
message(FATAL_ERROR \"Qt 5 $${CMAKE_MODULE_NAME} module requires at least CMake version 3.1.0\")
endif()
+!!IF isEmpty(CMAKE_STATIC_TYPE)
+# "redirect" to static package overriding variant prefix so it does not contain "Static" anymore
+option(USE_STATIC_QT_BY_DEFAULT \"specifies whether to use static Qt by default (rather than via Static-prefix)\" OFF)
+if(USE_STATIC_QT_BY_DEFAULT)
+ set(ORIGINAL_OVERRIDE_QT_VARIANT_PREFIX "${OVERRIDE_QT_VARIANT_PREFIX}")
+ if(OVERRIDE_QT_VARIANT_PREFIX)
+ string(REPLACE \"Static\" \"\" OVERRIDE_QT_VARIANT_PREFIX "${OVERRIDE_QT_VARIANT_PREFIX}")
+ endif()
+ if(NOT OVERRIDE_QT_VARIANT_PREFIX)
+ set(OVERRIDE_QT_VARIANT_PREFIX "none")
+ endif()
+ find_package(StaticQt5$${CMAKE_MODULE_NAME})
+ set(OVERRIDE_QT_VARIANT_PREFIX "${ORIGINAL_OVERRIDE_QT_VARIANT_PREFIX}")
+ return()
+endif()
+!!ENDIF
+
+if(OVERRIDE_QT_VARIANT_PREFIX)
+ if(OVERRIDE_QT_VARIANT_PREFIX STREQUAL "none")
+ unset(QT_VARIANT_PREFIX)
+ else()
+ set(QT_VARIANT_PREFIX "${OVERRIDE_QT_VARIANT_PREFIX}")
+ endif()
+else()
+ set(QT_VARIANT_PREFIX \"$${DEFAULT_QT_VARIANT_PREFIX}\")
+endif()
+
!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
@@ -28,15 +55,19 @@ set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
!!IF !equals(TEMPLATE, aux)
# For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
-set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.VERSION)")
+set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.VERSION)")
-set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME})
+set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_LIBRARIES ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME})
!!ENDIF // TEMPLATE != aux
-macro(_qt5_$${CMAKE_MODULE_NAME}_check_file_exists file)
- if(NOT EXISTS \"${file}\" )
- message(FATAL_ERROR \"The imported target \\\"Qt5::$${CMAKE_MODULE_NAME}\\\" references the file
- \\\"${file}\\\"
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+macro(_qt5_$${CMAKE_MODULE_NAME}_check_file_exists_static FILE)
+!!ELSE
+macro(_qt5_$${CMAKE_MODULE_NAME}_check_file_exists FILE)
+!!ENDIF
+ if(NOT EXISTS \"${FILE}\")
+ message(FATAL_ERROR \"The imported target \\\"${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME}\\\" references the file
+ \\\"${FILE}\\\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
@@ -177,12 +208,24 @@ if(NOT COMMAND _qt5_add_dependencies)
endif()
endfunction()
endif()
+
+# ensure also regular/dynamic macro exists because it might be used in some extra config
+if(NOT COMMAND _qt5_$${CMAKE_MODULE_NAME}_check_file_exists)
+ macro(_qt5_$${CMAKE_MODULE_NAME}_check_file_exists FILE)
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists_static(\"${FILE}\")
+ endmacro()
+endif()
!!ENDIF
!!IF !equals(TEMPLATE, aux)
-macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+macro(_populate_$${CMAKE_MODULE_NAME}_target_properties_static TARGET_NAME Configuration LIB_LOCATION IMPLIB_LOCATION
+ IsDebugAndRelease)
+!!ELSE
+macro(_populate_$${CMAKE_MODULE_NAME}_target_properties TARGET_NAME Configuration LIB_LOCATION IMPLIB_LOCATION
IsDebugAndRelease)
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+!!ENDIF
+ set_property(TARGET ${TARGET_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
@@ -200,20 +243,20 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
# FIXME: handle IsDebugAndRelease like in official version
!!IF !isEmpty(CMAKE_STATIC_TYPE)
- set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+ set_target_properties(\"${TARGET_NAME}\" PROPERTIES
\"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
!!IF !isEmpty(CMAKE_LIB_SONAME)
\"IMPORTED_SONAME_${Configuration}\" \"$${CMAKE_LIB_SONAME}\"
!!ENDIF
)
- _qt5_add_dependencies(Qt5::$${CMAKE_MODULE_NAME} \"${Configuration}\" \"${_deps}\")
+ _qt5_add_dependencies(\"${TARGET_NAME}\" \"${Configuration}\" \"${_deps}\")
if(NOT CMAKE_VERSION VERSION_LESS \"3.13\")
- set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+ set_target_properties(\"${TARGET_NAME}\" PROPERTIES
\"INTERFACE_LINK_OPTIONS\" \"${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LINK_FLAGS}\"
)
endif()
!!ELSE
- set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+ set_target_properties(\"${TARGET_NAME}\" PROPERTIES
\"INTERFACE_LINK_LIBRARIES_${Configuration}\" \"${_deps}\"
\"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
!!IF !isEmpty(CMAKE_LIB_SONAME)
@@ -230,9 +273,13 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
!!ELSE
set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
!!ENDIF
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists_static(${imported_implib})
+!!ELSE
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
+!!ENDIF
if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
- set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+ set_target_properties(${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
\"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
)
endif()
@@ -249,8 +296,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_plugin_target_dependencies_from_prl_file P
endmacro()
!!ENDIF
-if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
-
+if(NOT TARGET ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME})
!!IF !no_module_headers
!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
@@ -258,46 +304,50 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework/Headers\"
)
!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
)
-!!ELSE
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
-!!ENDIF
-!!ELSE
+!!ELSE // isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+!!ENDIF // isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+!!ELSE // !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
)
!!ELSE
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
!!ENDIF
!!ELSE
set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\" \"$${CMAKE_INCLUDE_DIR}$${CMAKE_INCLUDE_NAME}\")
!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
\"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
\"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
)
-!!ELSE
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
-!!ENDIF
-!!ENDIF
-!!ENDIF
+!!ELSE // isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+!!ENDIF // isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+!!ENDIF // isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+!!ENDIF // !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
!!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
!!ENDIF
!!ELSE
set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"\")
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
!!ENDIF
foreach(_dir ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS})
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists_static(${_dir})
+!!ELSE
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${_dir})
+!!ENDIF
endforeach()
!!IF isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
@@ -306,16 +356,20 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
list(FIND Qt5$${CMAKE_MODULE_NAME}_FIND_COMPONENTS Private _check_private)
if (NOT _check_private STREQUAL -1)
foreach(_dir ${Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS})
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists_static(${_dir})
+!!ELSE
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${_dir})
+!!ENDIF
endforeach()
endif()
!!ENDIF
!!IF !equals(TEMPLATE, aux)
- set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS})
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS})
- set(Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -D$${MODULE_DEFINE})
- set(Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS $${MODULE_DEFINES})
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -D$${MODULE_DEFINE})
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS $${MODULE_DEFINES})
!!ENDIF // TEMPLATE != aux
set(_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES \"$${CMAKE_MODULE_DEPS}\")
@@ -323,10 +377,10 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
list(APPEND _Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES \"$${CMAKE_INTERFACE_MODULE_DEPS}\")
!!ENDIF
- set(Qt5$${CMAKE_MODULE_NAME}_OWN_PRIVATE_INCLUDE_DIRS ${Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS})
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_OWN_PRIVATE_INCLUDE_DIRS ${Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS})
set(_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED)
- if (Qt5$${CMAKE_MODULE_NAME}_FIND_REQUIRED)
+ if (${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_FIND_REQUIRED)
set(_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED REQUIRED)
endif()
set(_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_QUIET)
@@ -334,17 +388,17 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
set(_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET QUIET)
endif()
set(_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT)
- if (Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT)
+ if (${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT)
set(_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT EXACT)
endif()
!!IF !equals(TEMPLATE, aux)
- set(Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS \"\")
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS \"\")
!!ENDIF // TEMPLATE != aux
foreach(_module_dep ${_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES})
- if (NOT Qt5${_module_dep}_FOUND)
- find_package(Qt5${_module_dep}
+ if (NOT ${QT_VARIANT_PREFIX}Qt5${_module_dep}_FOUND)
+ find_package(${QT_VARIANT_PREFIX}Qt5${_module_dep}
$$VERSION ${_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT}
${_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET}
${_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED}
@@ -352,25 +406,25 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
)
endif()
- if (NOT Qt5${_module_dep}_FOUND)
- set(Qt5$${CMAKE_MODULE_NAME}_FOUND False)
+ if (NOT ${QT_VARIANT_PREFIX}Qt5${_module_dep}_FOUND)
+ set(${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_FOUND False)
return()
endif()
!!IF !equals(TEMPLATE, aux)
- list(APPEND Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${Qt5${_module_dep}_INCLUDE_DIRS}\")
- list(APPEND Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"${Qt5${_module_dep}_PRIVATE_INCLUDE_DIRS}\")
- list(APPEND Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS ${Qt5${_module_dep}_DEFINITIONS})
- list(APPEND Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS ${Qt5${_module_dep}_COMPILE_DEFINITIONS})
- list(APPEND Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS ${Qt5${_module_dep}_EXECUTABLE_COMPILE_FLAGS})
+ list(APPEND ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${Qt5${_module_dep}_INCLUDE_DIRS}\")
+ list(APPEND ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"${Qt5${_module_dep}_PRIVATE_INCLUDE_DIRS}\")
+ list(APPEND ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS ${Qt5${_module_dep}_DEFINITIONS})
+ list(APPEND ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS ${Qt5${_module_dep}_COMPILE_DEFINITIONS})
+ list(APPEND ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS ${Qt5${_module_dep}_EXECUTABLE_COMPILE_FLAGS})
!!ENDIF // TEMPLATE != aux
endforeach()
!!IF !equals(TEMPLATE, aux)
- list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS)
- list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)
- list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS)
- list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS)
- list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
+ list(REMOVE_DUPLICATES ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS)
+ list(REMOVE_DUPLICATES ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)
+ list(REMOVE_DUPLICATES ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS)
+ list(REMOVE_DUPLICATES ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS)
+ list(REMOVE_DUPLICATES ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
!!ENDIF // TEMPLATE != aux
# It can happen that the same FooConfig.cmake file is included when calling find_package()
@@ -385,11 +439,16 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
#
# Make sure to return early in the original Config inclusion, because the target has already
# been defined as part of the second inclusion.
- if(TARGET Qt5::$${CMAKE_MODULE_NAME})
+ set(TARGET_NAME ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME})
+ if(TARGET ${TARGET_NAME})
return()
endif()
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ set(_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_QT5_MODULE_DEPS_STATIC}\")
+!!ELSE
set(_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_QT5_MODULE_DEPS}\")
+!!ENDIF
!!IF !isEmpty(CMAKE_INTERFACE_QT5_MODULE_DEPS)
list(APPEND _Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_INTERFACE_QT5_MODULE_DEPS}\")
@@ -400,13 +459,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!IF !isEmpty(CMAKE_DEBUG_TYPE)
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
_qt5_$${CMAKE_MODULE_NAME}_process_prl_file(
- \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG}\" DEBUG
+ \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG_STATIC}\" DEBUG
_Qt5$${CMAKE_MODULE_NAME}_STATIC_DEBUG_LIB_DEPENDENCIES
_Qt5$${CMAKE_MODULE_NAME}_STATIC_DEBUG_LINK_FLAGS
)
!!ELSE
_qt5_$${CMAKE_MODULE_NAME}_process_prl_file(
- \"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG}\" DEBUG
+ \"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG_STATIC}\" DEBUG
_Qt5$${CMAKE_MODULE_NAME}_STATIC_DEBUG_LIB_DEPENDENCIES
_Qt5$${CMAKE_MODULE_NAME}_STATIC_DEBUG_LINK_FLAGS
)
@@ -416,13 +475,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!IF !isEmpty(CMAKE_RELEASE_TYPE)
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
_qt5_$${CMAKE_MODULE_NAME}_process_prl_file(
- \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE}\" RELEASE
+ \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE_STATIC}\" RELEASE
_Qt5$${CMAKE_MODULE_NAME}_STATIC_RELEASE_LIB_DEPENDENCIES
_Qt5$${CMAKE_MODULE_NAME}_STATIC_RELEASE_LINK_FLAGS
)
!!ELSE
_qt5_$${CMAKE_MODULE_NAME}_process_prl_file(
- \"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE}\" RELEASE
+ \"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE_STATIC}\" RELEASE
_Qt5$${CMAKE_MODULE_NAME}_STATIC_RELEASE_LIB_DEPENDENCIES
_Qt5$${CMAKE_MODULE_NAME}_STATIC_RELEASE_LINK_FLAGS
)
@@ -431,49 +490,60 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
endif()
!!IF equals(TEMPLATE, aux)
- add_library(Qt5::$${CMAKE_MODULE_NAME} INTERFACE IMPORTED)
+ add_library(${TARGET_NAME} INTERFACE IMPORTED)
!!ELSE
- add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED)
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
+ add_library(${TARGET_NAME} STATIC IMPORTED)
+ set_property(TARGET ${TARGET_NAME} PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
!!ENDIF
!!ELSE // !isEmpty(CMAKE_STATIC_TYPE)
!!IF equals(TEMPLATE, aux)
- add_library(Qt5::$${CMAKE_MODULE_NAME} INTERFACE IMPORTED)
+ add_library(${TARGET_NAME} INTERFACE IMPORTED)
!!ELSE
- add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED)
+ add_library(${TARGET_NAME} SHARED IMPORTED)
!!ENDIF
!!ENDIF // !isEmpty(CMAKE_STATIC_TYPE)
!!IF !equals(TEMPLATE, aux)
!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1)
+ set_property(TARGET ${TARGET_NAME} PROPERTY FRAMEWORK 1)
+!!ENDIF
+!!ENDIF // TEMPLATE != aux
+
+!!IF !equals(TEMPLATE, aux)
+!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+ set_property(TARGET ${TARGET_NAME} PROPERTY FRAMEWORK 1)
!!ENDIF
!!ENDIF // TEMPLATE != aux
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY
+ set_property(TARGET ${TARGET_NAME} PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS})
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY
- INTERFACE_COMPILE_DEFINITIONS $${MODULE_DEFINES})
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ set_property(TARGET ${TARGET_NAME} PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS $${CMAKE_INTERFACE_COMPILE_DEFINITIONS_STATIC} $${MODULE_DEFINES})
+!!ELSE
+ set_property(TARGET ${TARGET_NAME} PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS $${MODULE_DEFINES})
+!!ENDIF
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_ENABLED_FEATURES $$join(QT.$${MODULE}.enabled_features, ";"))
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_DISABLED_FEATURES $$join(QT.$${MODULE}.disabled_features, ";"))
+ set_property(TARGET ${TARGET_NAME} PROPERTY INTERFACE_QT_ENABLED_FEATURES $$join(QT.$${MODULE}.enabled_features, ";"))
+ set_property(TARGET ${TARGET_NAME} PROPERTY INTERFACE_QT_DISABLED_FEATURES $$join(QT.$${MODULE}.disabled_features, ";"))
# Qt 6 forward compatible properties.
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}
+ set_property(TARGET ${TARGET_NAME}
PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_ENABLED_PUBLIC_FEATURES
$$join(QT.$${MODULE}.enabled_features, ";"))
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}
+ set_property(TARGET ${TARGET_NAME}
PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_DISABLED_PUBLIC_FEATURES
$$join(QT.$${MODULE}.disabled_features, ";"))
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}
+ set_property(TARGET ${TARGET_NAME}
PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_ENABLED_PRIVATE_FEATURES
$$join(QT.$${MODULE}_private.enabled_features, ";"))
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}
+ set_property(TARGET ${TARGET_NAME}
PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_DISABLED_PRIVATE_FEATURES
$$join(QT.$${MODULE}_private.disabled_features, ";"))
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_PLUGIN_TYPES \"$${CMAKE_MODULE_PLUGIN_TYPES}\")
+ set_property(TARGET ${TARGET_NAME} PROPERTY INTERFACE_QT_PLUGIN_TYPES \"$${CMAKE_MODULE_PLUGIN_TYPES}\")
# Find plugin targets
file(GLOB pluginTargetsMaybe \"${CMAKE_CURRENT_LIST_DIR}/*Qt5$${CMAKE_MODULE_NAME}_*.cmake\")
@@ -487,7 +557,11 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
endforeach()
endif()
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties_static TARGET_NAME PLUGIN_TARGET_NAME PLUGIN_NAME CONFIG PLUGIN_LOCATION)
+!!ELSE
macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties TARGET_NAME PLUGIN_TARGET_NAME PLUGIN_NAME CONFIG PLUGIN_LOCATION)
+!!ENDIF
set_property(TARGET ${PLUGIN_TARGET_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${CONFIG})
!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
@@ -495,7 +569,11 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE
set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
!!ENDIF
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists_static(${imported_location})
+!!ELSE
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+!!ENDIF
set_target_properties(${PLUGIN_TARGET_NAME} PROPERTIES
\"IMPORTED_LOCATION_${CONFIG}\" ${imported_location}
)
@@ -525,17 +603,20 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
endforeach()
endif()
+ # set TARGET_NAME back to current module (when loading plugin targets other modules might have been loaded in the meantime)
+ set(TARGET_NAME ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME})
+
set(_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIRS_EXIST TRUE)
- foreach (_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIR ${Qt5$${CMAKE_MODULE_NAME}_OWN_PRIVATE_INCLUDE_DIRS})
+ foreach (_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIR ${${TARGET_NAME}_OWN_PRIVATE_INCLUDE_DIRS})
if (NOT EXISTS ${_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIR})
set(_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIRS_EXIST FALSE)
endif()
endforeach()
if (_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIRS_EXIST)
- add_library(Qt5::$${CMAKE_MODULE_NAME}Private INTERFACE IMPORTED)
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}Private PROPERTY
- INTERFACE_INCLUDE_DIRECTORIES ${Qt5$${CMAKE_MODULE_NAME}_OWN_PRIVATE_INCLUDE_DIRS}
+ add_library(${TARGET_NAME}Private INTERFACE IMPORTED)
+ set_property(TARGET ${TARGET_NAME}Private PROPERTY
+ INTERFACE_INCLUDE_DIRECTORIES ${${TARGET_NAME}_OWN_PRIVATE_INCLUDE_DIRS}
)
set(_Qt5$${CMAKE_MODULE_NAME}_PRIVATEDEPS)
foreach(dep ${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES})
@@ -544,17 +625,18 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
endif()
endforeach()
!!IF !isEmpty(CMAKE_STATIC_TYPE)
- _qt5_add_dependencies(Qt5::$${CMAKE_MODULE_NAME}Private ALL \"Qt5::$${CMAKE_MODULE_NAME};${_Qt5$${CMAKE_MODULE_NAME}_PRIVATEDEPS}\")
+ _qt5_add_dependencies(${TARGET_NAME}Private ALL
+ \"${TARGET_NAME};${_Qt5$${CMAKE_MODULE_NAME}_PRIVATEDEPS}\")
!!ELSE
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}Private PROPERTY
- INTERFACE_LINK_LIBRARIES Qt5::$${CMAKE_MODULE_NAME} ${_Qt5$${CMAKE_MODULE_NAME}_PRIVATEDEPS}
+ set_property(TARGET ${TARGET_NAME}Private PROPERTY
+ INTERFACE_LINK_LIBRARIES ${TARGET_NAME} ${_Qt5$${CMAKE_MODULE_NAME}_PRIVATEDEPS}
)
# Add a versionless target, for compatibility with Qt6.
- if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::$${CMAKE_MODULE_NAME}Private)
- add_library(Qt::$${CMAKE_MODULE_NAME}Private INTERFACE IMPORTED)
- set_target_properties(Qt::$${CMAKE_MODULE_NAME}Private PROPERTIES
- INTERFACE_LINK_LIBRARIES \"Qt5::$${CMAKE_MODULE_NAME}Private\"
+ if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET ${QT_VARIANT_PREFIX}Qt::$${CMAKE_MODULE_NAME}Private)
+ add_library(${QT_VARIANT_PREFIX}Qt::$${CMAKE_MODULE_NAME}Private INTERFACE IMPORTED)
+ set_target_properties(${QT_VARIANT_PREFIX}Qt::$${CMAKE_MODULE_NAME}Private PROPERTIES
+ INTERFACE_LINK_LIBRARIES \"${TARGET_NAME}Private\"
)
endif()
!!ENDIF // CMAKE_STATIC_TYPE
@@ -562,59 +644,61 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!IF !equals(TEMPLATE, aux)
!!IF !isEmpty(CMAKE_RELEASE_TYPE)
-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
- _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ _populate_$${CMAKE_MODULE_NAME}_target_properties_static(${TARGET_NAME} RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
!!ELSE
- _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+ _populate_$${CMAKE_MODULE_NAME}_target_properties(${TARGET_NAME} RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
+!!ENDIF // CMAKE_STATIC_TYPE
+
!!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
!!IF isEmpty(CMAKE_DEBUG_TYPE)
-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
- if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG_STATIC}\" )
!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
- _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+ _populate_$${CMAKE_MODULE_NAME}_target_properties_static(${TARGET_NAME} DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG_STATIC}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
+ endif()
+!!ELSE // CMAKE_STATIC_TYPE
if (EXISTS
!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
!!ELSE
\"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
!!ENDIF
- AND EXISTS
+ AND EXISTS
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
!!ELSE
\"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
!!ENDIF
- _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+ _populate_$${CMAKE_MODULE_NAME}_target_properties(${TARGET_NAME} DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
endif()
+!!ENDIF // CMAKE_STATIC_TYPE
!!ENDIF // CMAKE_DEBUG_TYPE
!!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
-
!!ENDIF // CMAKE_RELEASE_TYPE
!!IF !isEmpty(CMAKE_DEBUG_TYPE)
-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
- _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ _populate_$${CMAKE_MODULE_NAME}_target_properties_static(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
!!ELSE
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+!!ENDIF // CMAKE_STATIC_TYPE
!!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
!!IF isEmpty(CMAKE_RELEASE_TYPE)
-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
- if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC}\" )
!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
- if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC}\" )
!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
- _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+ _populate_$${CMAKE_MODULE_NAME}_target_properties_static(${TARGET_NAME} RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
+!!ELSE // CMAKE_STATIC_TYPE
if (EXISTS
!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
@@ -627,7 +711,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE
\"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
!!ENDIF
- _populate_$${CMAKE_MODULE_NAME}_target_properties(Qt5::$${CMAKE_MODULE_NAME} RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
+ _populate_$${CMAKE_MODULE_NAME}_target_properties(${TARGET_NAME} RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
endif()
!!ENDIF // CMAKE_STATIC_TYPE
@@ -637,26 +721,29 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ENDIF // CMAKE_DEBUG_TYPE
!!ELSE // TEMPLATE != aux
- set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+ set_target_properties(${TARGET_NAME} PROPERTIES
INTERFACE_LINK_LIBRARIES \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
)
!!ENDIF // TEMPLATE != aux
!!IF !isEmpty(CMAKE_MODULE_EXTRAS)
- include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\")
+ include(\"${CMAKE_CURRENT_LIST_DIR}/../${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\")
!!ENDIF
-
!!IF !isEmpty(CMAKE_MODULE_MACROS)
- include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}Macros.cmake\")
+ include(\"${CMAKE_CURRENT_LIST_DIR}/../${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}Macros.cmake\")
!!ENDIF
- _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigVersion.cmake\")
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists_static(\"${CMAKE_CURRENT_LIST_DIR}/../${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}ConfigVersion.cmake\")
+!!ELSE
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(\"${CMAKE_CURRENT_LIST_DIR}/../${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}/${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}ConfigVersion.cmake\")
+!!ENDIF
endif()
# Add a versionless target, for compatibility with Qt6.
-if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND TARGET Qt5::$${CMAKE_MODULE_NAME} AND NOT TARGET Qt::$${CMAKE_MODULE_NAME})
- add_library(Qt::$${CMAKE_MODULE_NAME} INTERFACE IMPORTED)
- set_target_properties(Qt::$${CMAKE_MODULE_NAME} PROPERTIES
- INTERFACE_LINK_LIBRARIES \"Qt5::$${CMAKE_MODULE_NAME}\"
+if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND TARGET ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME} AND NOT TARGET ${QT_VARIANT_PREFIX}Qt::$${CMAKE_MODULE_NAME})
+ add_library(${QT_VARIANT_PREFIX}Qt::$${CMAKE_MODULE_NAME} INTERFACE IMPORTED)
+ set_target_properties(${QT_VARIANT_PREFIX}Qt::$${CMAKE_MODULE_NAME} PROPERTIES
+ INTERFACE_LINK_LIBRARIES \"${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME}\"
)
endif()
diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
index eaf9011c3d9..de09c85b90f 100644
--- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
@@ -1,13 +1,13 @@
# Some Qt modules also load plugin target in extra config, so check whether the target already exists
-if(NOT TARGET Qt5::$$CMAKE_PLUGIN_NAME)
- add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
+if(NOT TARGET ${QT_VARIANT_PREFIX}Qt5::$$CMAKE_PLUGIN_NAME)
+ add_library(${QT_VARIANT_PREFIX}Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
!!IF !isEmpty(CMAKE_STATIC_TYPE)
set(_Qt5$${CMAKE_PLUGIN_NAME}_MODULE_DEPENDENCIES \"$${CMAKE_PLUGIN_MODULE_DEPS}\")
foreach(_module_dep ${_Qt5$${CMAKE_PLUGIN_NAME}_MODULE_DEPENDENCIES})
- if(NOT Qt5${_module_dep}_FOUND)
- find_package(Qt5${_module_dep}
+ if(NOT ${QT_VARIANT_PREFIX}Qt5${_module_dep}_FOUND)
+ find_package(${QT_VARIANT_PREFIX}Qt5${_module_dep}
$$VERSION ${_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT}
${_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET}
${_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED}
@@ -15,19 +15,27 @@ foreach(_module_dep ${_Qt5$${CMAKE_PLUGIN_NAME}_MODULE_DEPENDENCIES})
)
endif()
endforeach()
+!!ENDIF
!!IF !isEmpty(CMAKE_RELEASE_TYPE)
- _populate_$${CMAKE_MODULE_NAME}_plugin_properties(Qt5::$$CMAKE_MODULE_NAME Qt5::$$CMAKE_PLUGIN_NAME $$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ _populate_$${CMAKE_MODULE_NAME}_plugin_properties_static(${QT_VARIANT_PREFIX}Qt5::$$CMAKE_MODULE_NAME ${QT_VARIANT_PREFIX}Qt5::$$CMAKE_PLUGIN_NAME $$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE_STATIC}\")
+!!ELSE
+ _populate_$${CMAKE_MODULE_NAME}_plugin_properties(${QT_VARIANT_PREFIX}Qt5::$$CMAKE_MODULE_NAME ${QT_VARIANT_PREFIX}Qt5::$$CMAKE_PLUGIN_NAME $$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
!!ENDIF
!!ENDIF
!!IF !isEmpty(CMAKE_DEBUG_TYPE)
- _populate_$${CMAKE_MODULE_NAME}_plugin_properties(Qt5::$$CMAKE_MODULE_NAME Qt5::$$CMAKE_PLUGIN_NAME $$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ _populate_$${CMAKE_MODULE_NAME}_plugin_properties_static(${QT_VARIANT_PREFIX}Qt5::$$CMAKE_MODULE_NAME ${QT_VARIANT_PREFIX}Qt5::$$CMAKE_PLUGIN_NAME $$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG_STATIC}\")
+!!ELSE
+ _populate_$${CMAKE_MODULE_NAME}_plugin_properties(${QT_VARIANT_PREFIX}Qt5::$$CMAKE_MODULE_NAME ${QT_VARIANT_PREFIX}Qt5::$$CMAKE_PLUGIN_NAME $$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+!!ENDIF
!!ENDIF
-list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
-set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY QT_ALL_PLUGINS_$${CMAKE_PLUGIN_TYPE_ESCAPED} Qt5::$${CMAKE_PLUGIN_NAME})
-set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_TYPE \"$$CMAKE_PLUGIN_TYPE\")
-set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_EXTENDS \"$$CMAKE_PLUGIN_EXTENDS\")
-set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_CLASS_NAME \"$$CMAKE_PLUGIN_NAME\")
+list(APPEND ${QT_VARIANT_PREFIX}Qt5$${CMAKE_MODULE_NAME}_PLUGINS ${QT_VARIANT_PREFIX}Qt5::$$CMAKE_PLUGIN_NAME)
+set_property(TARGET ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY QT_ALL_PLUGINS_$${CMAKE_PLUGIN_TYPE_ESCAPED} ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_PLUGIN_NAME})
+set_property(TARGET ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_TYPE \"$$CMAKE_PLUGIN_TYPE\")
+set_property(TARGET ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_EXTENDS \"$$CMAKE_PLUGIN_EXTENDS\")
+set_property(TARGET ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_CLASS_NAME \"$$CMAKE_PLUGIN_NAME\")
endif()
diff --git a/mkspecs/features/data/cmake/Qt5StaticOnlyRedirection.cmake.in b/mkspecs/features/data/cmake/Qt5StaticOnlyRedirection.cmake.in
new file mode 100644
index 00000000000..0091940fd26
--- /dev/null
+++ b/mkspecs/features/data/cmake/Qt5StaticOnlyRedirection.cmake.in
@@ -0,0 +1,11 @@
+# "redirect" to static package overriding variant prefix so it does not contain "Static" anymore
+set(ORIGINAL_OVERRIDE_QT_VARIANT_PREFIX "${OVERRIDE_QT_VARIANT_PREFIX}")
+if(OVERRIDE_QT_VARIANT_PREFIX)
+ string(REPLACE \"Static\" \"\" OVERRIDE_QT_VARIANT_PREFIX "${OVERRIDE_QT_VARIANT_PREFIX}")
+endif()
+if(NOT OVERRIDE_QT_VARIANT_PREFIX)
+ set(OVERRIDE_QT_VARIANT_PREFIX "none")
+endif()
+find_package(StaticQt5$${CMAKE_MODULE_NAME})
+set(OVERRIDE_QT_VARIANT_PREFIX "${ORIGINAL_OVERRIDE_QT_VARIANT_PREFIX}")
+
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 4ceafb6445e..774d8b6c2f7 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -2,6 +2,8 @@ if(NOT DEFINED QT_DEFAULT_MAJOR_VERSION)
set(QT_DEFAULT_MAJOR_VERSION 5)
endif()
+set(IMPORTED_TARGET_NAME ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME})
+
if (NOT TARGET Qt5::qmake)
add_executable(Qt5::qmake IMPORTED)
@@ -56,12 +58,12 @@ set(Qt5Core_QMAKE_EXECUTABLE Qt5::qmake)
set(Qt5Core_MOC_EXECUTABLE Qt5::moc)
set(Qt5Core_RCC_EXECUTABLE Qt5::rcc)
-set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_MAJOR_VERSION 5)
-set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_COORD_TYPE $$QT_COORD_TYPE)
+set_property(TARGET ${IMPORTED_TARGET_NAME} PROPERTY INTERFACE_QT_MAJOR_VERSION 5)
+set_property(TARGET ${IMPORTED_TARGET_NAME} PROPERTY INTERFACE_QT_COORD_TYPE $$QT_COORD_TYPE)
!!IF !isEmpty(CMAKE_MIN_DARWIN_DEPLOYMENT_TARGET)
-set_property(TARGET Qt5::Core PROPERTY QT_DARWIN_MIN_DEPLOYMENT_TARGET \"$$CMAKE_MIN_DARWIN_DEPLOYMENT_TARGET\")
+set_property(TARGET ${IMPORTED_TARGET_NAME} PROPERTY QT_DARWIN_MIN_DEPLOYMENT_TARGET \"$$CMAKE_MIN_DARWIN_DEPLOYMENT_TARGET\")
!!ENDIF
-set_property(TARGET Qt5::Core APPEND PROPERTY
+set_property(TARGET ${IMPORTED_TARGET_NAME} APPEND PROPERTY
COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION QT_COORD_TYPE
)
@@ -72,7 +74,7 @@ foreach(_dir ${_qt5_corelib_extra_includes})
endforeach()
list(APPEND Qt5Core_INCLUDE_DIRS ${_qt5_corelib_extra_includes})
-set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5_corelib_extra_includes})
+set_property(TARGET ${IMPORTED_TARGET_NAME} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5_corelib_extra_includes})
set(_qt5_corelib_extra_includes)
# Targets using Qt need to use the POSITION_INDEPENDENT_CODE property. The
@@ -87,7 +89,7 @@ set(Qt5_POSITION_INDEPENDENT_CODE True)
# Applications now need to be compiled with the -fPIC option if the Qt option
# \"reduce relocations\" is active. For backward compatibility only, Qt accepts
# the use of -fPIE for GCC 4.x versions.
-set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_OPTIONS $$QMAKE_CXXFLAGS_APP)
+set_property(TARGET ${IMPORTED_TARGET_NAME} APPEND PROPERTY INTERFACE_COMPILE_OPTIONS $$QMAKE_CXXFLAGS_APP)
# TODO Qt6: Remove
set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"\")
@@ -95,7 +97,7 @@ set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"\")
!!IF !isEmpty(QT_NAMESPACE)
list(APPEND Qt5Core_DEFINITIONS -DQT_NAMESPACE=$$QT_NAMESPACE)
list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE)
-set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE)
+set_property(TARGET ${IMPORTED_TARGET_NAME} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE)
!!ENDIF
!!IF !isEmpty(CMAKE_DISABLED_FEATURES)
@@ -104,9 +106,9 @@ set(Qt5_DISABLED_FEATURES
)
!!ENDIF
-set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
+set_property(TARGET ${IMPORTED_TARGET_NAME} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
-set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)
+set_property(TARGET ${IMPORTED_TARGET_NAME} PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)
!!IF qtConfig(reduce_exports)
set(QT_VISIBILITY_AVAILABLE \"True\")
@@ -154,14 +156,14 @@ if (NOT TARGET Qt5::WinMain)
set(_isWin32 $<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>)
set(_isNotExcluded $<NOT:$<BOOL:$<TARGET_PROPERTY:Qt5_NO_LINK_QTMAIN>>>)
set(_isPolicyNEW $<TARGET_POLICY:CMP0020>)
- get_target_property(_configs Qt5::Core IMPORTED_CONFIGURATIONS)
- set_property(TARGET Qt5::Core APPEND PROPERTY
+ get_target_property(_configs ${IMPORTED_TARGET_NAME} IMPORTED_CONFIGURATIONS)
+ set_property(TARGET ${IMPORTED_TARGET_NAME} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt5::WinMain>
)
# For backward compatibility with CMake < 2.8.12
foreach(_config ${_configs})
- set_property(TARGET Qt5::Core APPEND PROPERTY
+ set_property(TARGET ${IMPORTED_TARGET_NAME} APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt5::WinMain>
)
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
index 84dbbfebd47..31fa875b6c7 100644
--- a/src/gui/Qt5GuiConfigExtras.cmake.in
+++ b/src/gui/Qt5GuiConfigExtras.cmake.in
@@ -1,4 +1,6 @@
+set(IMPORTED_TARGET_NAME ${QT_VARIANT_PREFIX}Qt5::$${CMAKE_MODULE_NAME})
+
!!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
@@ -67,7 +69,7 @@ unset(_GL_INCDIRS)
# optional.
list(APPEND Qt5Gui_INCLUDE_DIRS ${_qt5gui_OPENGL_INCLUDE_DIR})
-set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5gui_OPENGL_INCLUDE_DIR})
+set_property(TARGET ${IMPORTED_TARGET_NAME} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5gui_OPENGL_INCLUDE_DIR})
unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE)
@@ -183,9 +185,9 @@ _qt5gui_find_extra_libs(OPENGL \"$$CMAKE_OPENGL_LIBS\" \"$$CMAKE_OPENGL_LIBDIR\"
set(Qt5Gui_OPENGL_IMPLEMENTATION $$CMAKE_QT_OPENGL_IMPLEMENTATION)
-get_target_property(_configs Qt5::Gui IMPORTED_CONFIGURATIONS)
+get_target_property(_configs ${IMPORTED_TARGET_NAME} IMPORTED_CONFIGURATIONS)
foreach(_config ${_configs})
- set_property(TARGET Qt5::Gui APPEND PROPERTY
+ set_property(TARGET ${IMPORTED_TARGET_NAME} APPEND PROPERTY
IMPORTED_LINK_DEPENDENT_LIBRARIES_${_config}
${Qt5Gui_EGL_LIBRARIES} ${Qt5Gui_OPENGL_LIBRARIES}
)
diff --git a/src/testlib/Qt5TestConfigExtras.cmake.in b/src/testlib/Qt5TestConfigExtras.cmake.in
index 2a575958ae4..ca0e3be3b56 100644
--- a/src/testlib/Qt5TestConfigExtras.cmake.in
+++ b/src/testlib/Qt5TestConfigExtras.cmake.in
@@ -1,5 +1,5 @@
-set_property(TARGET Qt5::Test
+set_property(TARGET ${QT_VARIANT_PREFIX}Qt5::Test
APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS QT_TESTCASE_BUILDDIR=\\\"\${CMAKE_BINARY_DIR}\\\"
)
--
2.47.0
|