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
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
|
Upstream PR: https://github.com/apple/swift/pull/65534
commit 112681f7f5927588569b225d926ca9f5f9ec98b3
Author: Stéphan Kochen <git@stephank.nl>
Date: Sat Apr 29 20:34:40 2023 +0200
build: fix accidental cmake expansions
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:
- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
expands to 1, where it would previously coerce to a string.
- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
left-hand side expands twice.
In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:
- Quoted right-hand side of `STREQUAL` where I was confident it was
intended to be a string literal.
- Removed manual variable expansion on left-hand side of `STREQUAL`,
`MATCHES` and `IN_LIST` where I was confident it was unintended.
Fixes #65028.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eaab71fbaf0..45aa5d65dd3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -119,7 +119,7 @@ else()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|amd64")
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64")
- if(SWIFT_HOST_VARIANT_SDK_default STREQUAL OSX)
+ if(SWIFT_HOST_VARIANT_SDK_default STREQUAL "OSX")
set(SWIFT_HOST_VARIANT_ARCH_default "arm64")
else()
set(SWIFT_HOST_VARIANT_ARCH_default "aarch64")
@@ -336,7 +336,7 @@ set(SWIFT_STDLIB_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
# - MultiThreadedDebug (/MTd)
# - MultiThreadedDLL (/MD)
# - MultiThreadedDebugDLL (/MDd)
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY_default MultiThreadedDebugDLL)
else()
set(SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY_default MultiThreadedDLL)
@@ -598,7 +598,7 @@ if(SWIFT_BUILT_STANDALONE)
project(Swift C CXX ASM)
endif()
-if(MSVC OR "${CMAKE_SIMULATE_ID}" STREQUAL MSVC)
+if(MSVC OR "${CMAKE_SIMULATE_ID}" STREQUAL "MSVC")
include(ClangClCompileRules)
elseif(UNIX)
include(UnixCompileRules)
@@ -627,7 +627,7 @@ if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND "${SWIFT_CONCURRENCY_GLOBAL_EXECUTO
endif()
set(SWIFT_BUILD_HOST_DISPATCH FALSE)
-if(SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Only build libdispatch for the host if the host tools are being built and
# specifically if these two libraries that depend on it are built.
if(SWIFT_INCLUDE_TOOLS AND SWIFT_BUILD_SOURCEKIT)
@@ -801,11 +801,11 @@ endif()
# build environment.
if(LLVM_USE_LINKER)
set(SWIFT_USE_LINKER_default "${LLVM_USE_LINKER}")
-elseif(${SWIFT_HOST_VARIANT_SDK} STREQUAL ANDROID)
+elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID")
set(SWIFT_USE_LINKER_default "lld")
-elseif(CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(SWIFT_USE_LINKER_default "lld")
-elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(SWIFT_USE_LINKER_default "")
else()
set(SWIFT_USE_LINKER_default "gold")
diff --git a/SwiftCompilerSources/CMakeLists.txt b/SwiftCompilerSources/CMakeLists.txt
index 225e72663a1..d14e0ccecac 100644
--- a/SwiftCompilerSources/CMakeLists.txt
+++ b/SwiftCompilerSources/CMakeLists.txt
@@ -80,7 +80,7 @@ function(add_swift_compiler_modules_library name)
list(APPEND swift_compile_options "-Xfrontend" "-disable-implicit-string-processing-module-import")
endif()
- if(CMAKE_BUILD_TYPE STREQUAL Debug)
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND swift_compile_options "-g")
else()
list(APPEND swift_compile_options "-O" "-cross-module-optimization")
@@ -98,7 +98,7 @@ function(add_swift_compiler_modules_library name)
set(deployment_version "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
set(sdk_path "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
set(sdk_option "-sdk" "${sdk_path}")
- if(${BOOTSTRAPPING_MODE} STREQUAL "CROSSCOMPILE-WITH-HOSTLIBS")
+ if(BOOTSTRAPPING_MODE STREQUAL "CROSSCOMPILE-WITH-HOSTLIBS")
# Let the cross-compiled compile don't pick up the compiled stdlib by providing
# an (almost) empty resource dir.
# The compiler will instead pick up the stdlib from the SDK.
@@ -117,7 +117,7 @@ function(add_swift_compiler_modules_library name)
message(ERROR "libc++ not found in the toolchain.")
endif()
endif()
- elseif(${BOOTSTRAPPING_MODE} STREQUAL "CROSSCOMPILE")
+ elseif(BOOTSTRAPPING_MODE STREQUAL "CROSSCOMPILE")
set(sdk_option "-sdk" "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
get_filename_component(swift_exec_bin_dir ${ALS_SWIFT_EXEC} DIRECTORY)
set(sdk_option ${sdk_option} "-resource-dir" "${swift_exec_bin_dir}/../lib/swift")
@@ -253,13 +253,13 @@ else()
add_dependencies(importedHeaderDependencies swift-ast-generated-headers)
target_include_directories(importedHeaderDependencies PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../include/swift")
- if(${BOOTSTRAPPING_MODE} MATCHES "HOSTTOOLS|CROSSCOMPILE")
+ if(BOOTSTRAPPING_MODE MATCHES "HOSTTOOLS|CROSSCOMPILE")
if (NOT SWIFT_EXEC_FOR_SWIFT_MODULES)
message(FATAL_ERROR "Need a swift toolchain building swift compiler sources")
endif()
- if(${BOOTSTRAPPING_MODE} STREQUAL "HOSTTOOLS")
+ if(BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
if(NOT SWIFT_EXEC_FOR_SWIFT_MODULES STREQUAL CMAKE_Swift_COMPILER)
message(FATAL_ERROR "The Swift compiler (${CMAKE_Swift_COMPILER}) differs from the Swift compiler in SWIFT_NATIVE_SWIFT_TOOLS_PATH (${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc).")
endif()
@@ -275,11 +275,11 @@ else()
add_swift_compiler_modules_library(swiftCompilerModules
SWIFT_EXEC "${SWIFT_EXEC_FOR_SWIFT_MODULES}")
- elseif(${BOOTSTRAPPING_MODE} MATCHES "BOOTSTRAPPING.*")
+ elseif(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
set(b0_deps swift-frontend-bootstrapping0 symlink-headers-bootstrapping0)
set(b1_deps swift-frontend-bootstrapping1 symlink-headers-bootstrapping1)
- if(${BOOTSTRAPPING_MODE} STREQUAL "BOOTSTRAPPING")
+ if(BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING")
list(APPEND b0_deps swiftCore-bootstrapping0)
list(APPEND b1_deps swiftCore-bootstrapping1)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
@@ -290,7 +290,7 @@ else()
list(APPEND b0_deps swiftDarwin-bootstrapping0)
list(APPEND b1_deps swiftDarwin-bootstrapping1)
endif()
- if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_LIBSTDCXX_PLATFORMS)
+ if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_LIBSTDCXX_PLATFORMS)
list(APPEND b0_deps copy-libstdcxx-modulemap-bootstrapping0 copy-libstdcxx-header-bootstrapping0)
list(APPEND b1_deps copy-libstdcxx-modulemap-bootstrapping1 copy-libstdcxx-header-bootstrapping1)
endif()
diff --git a/benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake b/benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake
index dd989efe618..3ed37754214 100644
--- a/benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake
+++ b/benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake
@@ -21,7 +21,7 @@ macro(configure_build)
# thus allowing the --host-cc build-script argument to work here.
get_filename_component(c_compiler ${CMAKE_C_COMPILER} NAME)
- if(${c_compiler} STREQUAL "clang")
+ if(c_compiler STREQUAL "clang")
set(CLANG_EXEC ${CMAKE_C_COMPILER})
else()
if(NOT SWIFT_DARWIN_XCRUN_TOOLCHAIN)
@@ -713,7 +713,7 @@ function(swift_benchmark_compile)
if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
set(stdlib_dependencies "swift-frontend" "swiftCore-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
- if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
+ if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
list(APPEND stdlib_dependencies "swiftDarwin-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
endif()
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake
index 58c7eb1bd4f..96c4fe804f9 100644
--- a/cmake/modules/AddSwift.cmake
+++ b/cmake/modules/AddSwift.cmake
@@ -63,16 +63,16 @@ function(_set_target_prefix_and_suffix target kind sdk)
precondition(kind MESSAGE "kind is required")
precondition(sdk MESSAGE "sdk is required")
- if(${sdk} STREQUAL ANDROID)
- if(${kind} STREQUAL STATIC)
+ if(sdk STREQUAL "ANDROID")
+ if(kind STREQUAL "STATIC")
set_target_properties(${target} PROPERTIES PREFIX "lib" SUFFIX ".a")
- elseif(${kind} STREQUAL SHARED)
+ elseif(kind STREQUAL "SHARED")
set_target_properties(${target} PROPERTIES PREFIX "lib" SUFFIX ".so")
endif()
- elseif(${sdk} STREQUAL WINDOWS)
- if(${kind} STREQUAL STATIC)
+ elseif(sdk STREQUAL "WINDOWS")
+ if(kind STREQUAL "STATIC")
set_target_properties(${target} PROPERTIES PREFIX "" SUFFIX ".lib")
- elseif(${kind} STREQUAL SHARED)
+ elseif(kind STREQUAL "SHARED")
set_target_properties(${target} PROPERTIES PREFIX "" SUFFIX ".dll")
endif()
endif()
@@ -115,7 +115,7 @@ function(_add_host_variant_c_compile_link_flags name)
set(DEPLOYMENT_VERSION "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
endif()
- if(SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID")
set(DEPLOYMENT_VERSION ${SWIFT_ANDROID_API_LEVEL})
endif()
@@ -151,7 +151,7 @@ function(_add_host_variant_c_compile_link_flags name)
target_compile_options(${name} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:--sysroot=${_sysroot}>)
endif()
- if(SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID")
# Make sure the Android NDK lld is used.
swift_android_tools_path(${SWIFT_HOST_VARIANT_ARCH} tools_path)
target_compile_options(${name} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-B${tools_path}>)
@@ -223,7 +223,7 @@ function(_add_host_variant_c_compile_flags target)
endif()
endif()
- if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "WINDOWS")
# MSVC/clang-cl don't support -fno-pic or -fms-compatibility-version.
if(NOT SWIFT_COMPILER_IS_MSVC_LIKE)
target_compile_options(${target} PRIVATE
@@ -276,14 +276,14 @@ function(_add_host_variant_c_compile_flags target)
# NOTE(compnerd) workaround LLVM invoking `add_definitions(-D_DEBUG)` which
# causes failures for the runtime library when cross-compiling due to
# undefined symbols from the standard library.
- if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
+ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(${target} PRIVATE
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-U_DEBUG>)
endif()
endif()
- if(SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID)
- if(SWIFT_HOST_VARIANT_ARCH STREQUAL x86_64)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID")
+ if(SWIFT_HOST_VARIANT_ARCH STREQUAL "x86_64")
# NOTE(compnerd) Android NDK 21 or lower will generate library calls to
# `__sync_val_compare_and_swap_16` rather than lowering to the CPU's
# `cmpxchg16b` instruction as the `cx16` feature is disabled due to a bug
@@ -317,15 +317,15 @@ function(_add_host_variant_c_compile_flags target)
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-fprofile-instr-generate -fcoverage-mapping>)
endif()
- if((SWIFT_HOST_VARIANT_ARCH STREQUAL armv7 OR
- SWIFT_HOST_VARIANT_ARCH STREQUAL aarch64) AND
- (SWIFT_HOST_VARIANT_SDK STREQUAL LINUX OR
- SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID))
+ if((SWIFT_HOST_VARIANT_ARCH STREQUAL "armv7" OR
+ SWIFT_HOST_VARIANT_ARCH STREQUAL "aarch64") AND
+ (SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX" OR
+ SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID"))
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-funwind-tables>)
endif()
if(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX")
- if(SWIFT_HOST_VARIANT_ARCH STREQUAL x86_64)
+ if(SWIFT_HOST_VARIANT_ARCH STREQUAL "x86_64")
# this is the minimum architecture that supports 16 byte CAS, which is
# necessary to avoid a dependency to libatomic
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-march=core2>)
@@ -336,7 +336,7 @@ function(_add_host_variant_c_compile_flags target)
# llvm/llvm-project@66395c9, which can cause incompatibilities with the Swift
# frontend if not built the same way.
if("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "armv6|armv7|i686" AND
- NOT (SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID AND SWIFT_ANDROID_API_LEVEL LESS 24))
+ NOT (SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID" AND SWIFT_ANDROID_API_LEVEL LESS 24))
target_compile_definitions(${target} PRIVATE
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:_LARGEFILE_SOURCE _FILE_OFFSET_BITS=64>)
endif()
@@ -345,19 +345,19 @@ endfunction()
function(_add_host_variant_link_flags target)
_add_host_variant_c_compile_link_flags(${target})
- if(SWIFT_HOST_VARIANT_SDK STREQUAL LINUX)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX")
target_link_libraries(${target} PRIVATE
pthread
dl)
if("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "armv5|armv6|armv7|i686")
target_link_libraries(${target} PRIVATE atomic)
endif()
- elseif(SWIFT_HOST_VARIANT_SDK STREQUAL FREEBSD)
+ elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "FREEBSD")
target_link_libraries(${target} PRIVATE
pthread)
- elseif(SWIFT_HOST_VARIANT_SDK STREQUAL CYGWIN)
+ elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "CYGWIN")
# No extra libraries required.
- elseif(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
+ elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "WINDOWS")
# We don't need to add -nostdlib using MSVC or clang-cl, as MSVC and
# clang-cl rely on auto-linking entirely.
if(NOT SWIFT_COMPILER_IS_MSVC_LIKE)
@@ -375,12 +375,12 @@ function(_add_host_variant_link_flags target)
# the Windows SDK on case sensitive file systems.
target_link_directories(${target} PRIVATE
${CMAKE_BINARY_DIR}/winsdk_lib_${SWIFT_HOST_VARIANT_ARCH}_symlinks)
- elseif(SWIFT_HOST_VARIANT_SDK STREQUAL HAIKU)
+ elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "HAIKU")
target_link_libraries(${target} PRIVATE
bsd)
target_link_options(${target} PRIVATE
"SHELL:-Xlinker -Bsymbolic")
- elseif(SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID)
+ elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID")
target_link_libraries(${target} PRIVATE
dl
log
@@ -422,7 +422,7 @@ function(_add_host_variant_link_flags target)
#
# TODO: Evaluate/enable -f{function,data}-sections --gc-sections for bfd,
# gold, and lld.
- if(NOT CMAKE_BUILD_TYPE STREQUAL Debug AND CMAKE_SYSTEM_NAME MATCHES Darwin)
+ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_SYSTEM_NAME MATCHES Darwin)
if (NOT SWIFT_DISABLE_DEAD_STRIPPING)
# See rdar://48283130: This gives 6MB+ size reductions for swift and
# SourceKitService, and much larger size reductions for sil-opt etc.
@@ -446,7 +446,7 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
# RPATH where Swift runtime can be found.
set(swift_runtime_rpath)
- if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
+ if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
set(sdk_dir "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}/usr/lib/swift")
@@ -529,7 +529,7 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
elseif(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD")
set(swiftrt "swiftImageRegistrationObject${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_OBJECT_FORMAT}-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}-${SWIFT_HOST_VARIANT_ARCH}")
- if(${ASRLF_BOOTSTRAPPING_MODE} MATCHES "HOSTTOOLS|CROSSCOMPILE")
+ if(ASRLF_BOOTSTRAPPING_MODE MATCHES "HOSTTOOLS|CROSSCOMPILE")
# At build time and run time, link against the swift libraries in the
# installed host toolchain.
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
@@ -575,7 +575,7 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
# able to fall back to the SDK directory for libswiftCore et al.
if (BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
if (NOT "${bootstrapping}" STREQUAL "1")
- if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
+ if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
target_link_directories(${target} PRIVATE "${sdk_dir}")
# Include the abi stable system stdlib in our rpath.
@@ -706,10 +706,10 @@ function(add_swift_host_library name)
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
set_target_properties(${name} PROPERTIES
INSTALL_NAME_DIR "@rpath")
- elseif(SWIFT_HOST_VARIANT_SDK STREQUAL LINUX)
+ elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX")
set_target_properties(${name} PROPERTIES
INSTALL_RPATH "$ORIGIN")
- elseif(SWIFT_HOST_VARIANT_SDK STREQUAL CYGWIN)
+ elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "CYGWIN")
set_target_properties(${name} PROPERTIES
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/cygwin")
elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "ANDROID")
@@ -731,18 +731,18 @@ function(add_swift_host_library name)
endif()
# Set compilation and link flags.
- if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "WINDOWS")
swift_windows_include_for_arch(${SWIFT_HOST_VARIANT_ARCH}
${SWIFT_HOST_VARIANT_ARCH}_INCLUDE)
target_include_directories(${name} SYSTEM PRIVATE
${${SWIFT_HOST_VARIANT_ARCH}_INCLUDE})
- if(libkind STREQUAL SHARED)
+ if(libkind STREQUAL "SHARED")
target_compile_definitions(${name} PRIVATE
_WINDLL)
endif()
- if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL MSVC)
+ if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
swift_windows_get_sdk_vfs_overlay(ASHL_VFS_OVERLAY)
# Both clang and clang-cl on Windows set CMAKE_C_SIMULATE_ID to MSVC.
# We are using CMAKE_C_COMPILER_FRONTEND_VARIANT to detect the correct
@@ -770,7 +770,7 @@ function(add_swift_host_library name)
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE CXX)
- if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
+ if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
target_link_options(${name} PRIVATE
"LINKER:-compatibility_version,1")
if(SWIFT_COMPILER_VERSION)
@@ -856,7 +856,7 @@ function(add_swift_host_tool executable)
add_dependencies(${executable} ${LLVM_COMMON_DEPENDS})
endif()
- if(NOT ${ASHT_BOOTSTRAPPING} STREQUAL "")
+ if(NOT "${ASHT_BOOTSTRAPPING}" STREQUAL "")
# Strip the "-bootstrapping<n>" suffix from the target name to get the base
# executable name.
string(REGEX REPLACE "-bootstrapping.*" "" executable_filename ${executable})
@@ -891,7 +891,7 @@ function(add_swift_host_tool executable)
BINARY_DIR ${out_bin_dir}
LIBRARY_DIR ${out_lib_dir})
- if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "WINDOWS")
swift_windows_include_for_arch(${SWIFT_HOST_VARIANT_ARCH}
${SWIFT_HOST_VARIANT_ARCH}_INCLUDE)
target_include_directories(${executable} SYSTEM PRIVATE
@@ -913,8 +913,8 @@ function(add_swift_host_tool executable)
if(SWIFT_SWIFT_PARSER)
set(extra_relative_rpath "")
- if(NOT ${ASHT_BOOTSTRAPPING} STREQUAL "")
- if (${executable} MATCHES "-bootstrapping")
+ if(NOT "${ASHT_BOOTSTRAPPING}" STREQUAL "")
+ if(executable MATCHES "-bootstrapping")
set(extra_relative_rpath "../")
endif()
endif()
@@ -938,7 +938,7 @@ function(add_swift_host_tool executable)
target_link_options(${executable} PRIVATE "${lto_codegen_only_link_options}")
endif()
- if(NOT ${ASHT_SWIFT_COMPONENT} STREQUAL "no_component")
+ if(NOT ASHT_SWIFT_COMPONENT STREQUAL "no_component")
add_dependencies(${ASHT_SWIFT_COMPONENT} ${executable})
swift_install_in_component(TARGETS ${executable}
RUNTIME
diff --git a/cmake/modules/Libdispatch.cmake b/cmake/modules/Libdispatch.cmake
index f0ea3577a2b..3fb0ecdce89 100644
--- a/cmake/modules/Libdispatch.cmake
+++ b/cmake/modules/Libdispatch.cmake
@@ -1,13 +1,13 @@
include(ExternalProject)
-if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
- if(CMAKE_C_COMPILER_ID STREQUAL Clang AND
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER 3.8
OR LLVM_USE_SANITIZER)
set(SWIFT_LIBDISPATCH_C_COMPILER ${CMAKE_C_COMPILER})
set(SWIFT_LIBDISPATCH_CXX_COMPILER ${CMAKE_CXX_COMPILER})
- elseif(${CMAKE_SYSTEM_NAME} STREQUAL ${CMAKE_HOST_SYSTEM_NAME})
- if(CMAKE_SYSTEM_NAME STREQUAL Windows)
+ elseif(CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
+ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR AND
TARGET clang)
set(SWIFT_LIBDISPATCH_C_COMPILER
@@ -29,7 +29,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
message(SEND_ERROR "libdispatch requires a newer clang compiler (${CMAKE_C_COMPILER_VERSION} < 3.9)")
endif()
- if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "WINDOWS")
set(LIBDISPATCH_RUNTIME_DIR bin)
else()
set(LIBDISPATCH_RUNTIME_DIR lib)
@@ -40,7 +40,7 @@ set(DISPATCH_SDKS)
# Build the host libdispatch if needed.
if(SWIFT_BUILD_HOST_DISPATCH)
- if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
if(NOT "${SWIFT_HOST_VARIANT_SDK}" IN_LIST SWIFT_SDKS)
list(APPEND DISPATCH_SDKS "${SWIFT_HOST_VARIANT_SDK}")
endif()
@@ -52,20 +52,20 @@ foreach(sdk ${SWIFT_SDKS})
# Darwin targets have libdispatch available, do not build it.
# Wasm/WASI doesn't support libdispatch yet.
# See https://github.com/apple/swift/issues/54533 for more details.
- if(NOT "${sdk}" IN_LIST SWIFT_DARWIN_PLATFORMS AND NOT "${sdk}" STREQUAL WASI)
+ if(NOT "${sdk}" IN_LIST SWIFT_DARWIN_PLATFORMS AND NOT "${sdk}" STREQUAL "WASI")
list(APPEND DISPATCH_SDKS "${sdk}")
endif()
endforeach()
foreach(sdk ${DISPATCH_SDKS})
set(ARCHS ${SWIFT_SDK_${sdk}_ARCHITECTURES})
- if(${sdk} STREQUAL "${SWIFT_HOST_VARIANT_SDK}")
+ if(sdk STREQUAL "${SWIFT_HOST_VARIANT_SDK}")
if(NOT "${SWIFT_HOST_VARIANT_ARCH}" IN_LIST ARCHS)
list(APPEND ARCHS "${SWIFT_HOST_VARIANT_ARCH}")
endif()
endif()
- if(sdk STREQUAL ANDROID)
+ if(sdk STREQUAL "ANDROID")
set(SWIFT_LIBDISPATCH_COMPILER_CMAKE_ARGS)
else()
set(SWIFT_LIBDISPATCH_COMPILER_CMAKE_ARGS -DCMAKE_C_COMPILER=${SWIFT_LIBDISPATCH_C_COMPILER};-DCMAKE_CXX_COMPILER=${SWIFT_LIBDISPATCH_CXX_COMPILER})
diff --git a/cmake/modules/SwiftComponents.cmake b/cmake/modules/SwiftComponents.cmake
index 6816b75e8a4..2ec225140dc 100644
--- a/cmake/modules/SwiftComponents.cmake
+++ b/cmake/modules/SwiftComponents.cmake
@@ -82,7 +82,7 @@ list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "clang-builtin-headers-in-clang-resou
# This conflicts with LLVM itself when doing unified builds.
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "llvm-toolchain-dev-tools")
# The sourcekit install variants are currently mutually exclusive.
-if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "sourcekit-inproc")
else()
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "sourcekit-xpc-service")
diff --git a/cmake/modules/SwiftConfigureSDK.cmake b/cmake/modules/SwiftConfigureSDK.cmake
index d4cb352d658..5dd258cdd24 100644
--- a/cmake/modules/SwiftConfigureSDK.cmake
+++ b/cmake/modules/SwiftConfigureSDK.cmake
@@ -232,7 +232,7 @@ macro(configure_sdk_darwin
SWIFT_SDK_${prefix}_MODULE_ARCHITECTURES) # result
# Determine whether this is a simulator SDK.
- if ( ${xcrun_name} MATCHES "simulator" )
+ if(xcrun_name MATCHES "simulator")
set(SWIFT_SDK_${prefix}_IS_SIMULATOR TRUE)
else()
set(SWIFT_SDK_${prefix}_IS_SIMULATOR FALSE)
@@ -378,11 +378,11 @@ macro(configure_sdk_unix name architectures)
message(FATAL_ERROR "unknown arch for ${prefix}: ${arch}")
endif()
elseif("${prefix}" STREQUAL "FREEBSD")
- if(NOT arch STREQUAL x86_64)
+ if(NOT arch STREQUAL "x86_64")
message(FATAL_ERROR "unsupported arch for FreeBSD: ${arch}")
endif()
- if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL FreeBSD)
+ if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")
message(WARNING "CMAKE_SYSTEM_VERSION will not match target")
endif()
@@ -391,7 +391,7 @@ macro(configure_sdk_unix name architectures)
set(SWIFT_SDK_FREEBSD_ARCH_x86_64_TRIPLE "x86_64-unknown-freebsd${freebsd_system_version}")
elseif("${prefix}" STREQUAL "OPENBSD")
- if(NOT arch STREQUAL amd64)
+ if(NOT arch STREQUAL "amd64")
message(FATAL_ERROR "unsupported arch for OpenBSD: ${arch}")
endif()
@@ -404,17 +404,17 @@ macro(configure_sdk_unix name architectures)
set(SWIFT_SDK_OPENBSD_ARCH_${arch}_PATH "${CMAKE_SYSROOT}${SWIFT_SDK_OPENBSD_ARCH_${arch}_PATH}" CACHE INTERNAL "sysroot path" FORCE)
endif()
elseif("${prefix}" STREQUAL "CYGWIN")
- if(NOT arch STREQUAL x86_64)
+ if(NOT arch STREQUAL "x86_64")
message(FATAL_ERROR "unsupported arch for cygwin: ${arch}")
endif()
set(SWIFT_SDK_CYGWIN_ARCH_x86_64_TRIPLE "x86_64-unknown-windows-cygnus")
elseif("${prefix}" STREQUAL "HAIKU")
- if(NOT arch STREQUAL x86_64)
+ if(NOT arch STREQUAL "x86_64")
message(FATAL_ERROR "unsupported arch for Haiku: ${arch}")
endif()
set(SWIFT_SDK_HAIKU_ARCH_x86_64_TRIPLE "x86_64-unknown-haiku")
elseif("${prefix}" STREQUAL "WASI")
- if(NOT arch STREQUAL wasm32)
+ if(NOT arch STREQUAL "wasm32")
message(FATAL_ERROR "unsupported arch for WebAssembly: ${arch}")
endif()
set(SWIFT_SDK_WASI_ARCH_wasm32_PATH "${SWIFT_WASI_SYSROOT_PATH}")
@@ -459,7 +459,7 @@ macro(configure_sdk_windows name environment architectures)
get_threading_package(${prefix} "win32" SWIFT_SDK_${prefix}_THREADING_PACKAGE)
foreach(arch ${architectures})
- if(arch STREQUAL armv7)
+ if(arch STREQUAL "armv7")
set(SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE
"thumbv7-unknown-windows-${environment}")
else()
diff --git a/cmake/modules/SwiftWindowsSupport.cmake b/cmake/modules/SwiftWindowsSupport.cmake
index 6216b82c12b..a3432476658 100644
--- a/cmake/modules/SwiftWindowsSupport.cmake
+++ b/cmake/modules/SwiftWindowsSupport.cmake
@@ -2,13 +2,13 @@
include(SwiftUtils)
function(swift_windows_arch_spelling arch var)
- if(${arch} STREQUAL i686)
+ if(arch STREQUAL "i686")
set(${var} x86 PARENT_SCOPE)
- elseif(${arch} STREQUAL x86_64)
+ elseif(arch STREQUAL "x86_64")
set(${var} x64 PARENT_SCOPE)
- elseif(${arch} STREQUAL armv7)
+ elseif(arch STREQUAL "armv7")
set(${var} arm PARENT_SCOPE)
- elseif(${arch} STREQUAL aarch64)
+ elseif(arch STREQUAL "aarch64")
set(${var} arm64 PARENT_SCOPE)
else()
message(FATAL_ERROR "do not know MSVC spelling for ARCH: `${arch}`")
@@ -33,7 +33,7 @@ function(swift_windows_lib_for_arch arch var)
# a directory called "Lib" rather than VS2017 which normalizes the layout and
# places them in a directory named "lib".
if(IS_DIRECTORY "${VCToolsInstallDir}/Lib")
- if(${ARCH} STREQUAL x86)
+ if(ARCH STREQUAL "x86")
list(APPEND paths "${VCToolsInstallDir}/Lib/")
else()
list(APPEND paths "${VCToolsInstallDir}/Lib/${ARCH}")
diff --git a/include/swift/AST/CMakeLists.txt b/include/swift/AST/CMakeLists.txt
index 869d96ba13b..050695f65c6 100644
--- a/include/swift/AST/CMakeLists.txt
+++ b/include/swift/AST/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(SWIFT_GYB_FLAGS --line-directive "^\"#line %(line)d \\\"%(file)s\\\"^\"")
else()
set(SWIFT_GYB_FLAGS --line-directive "\'#line" "%(line)d" "\"%(file)s\"\'")
diff --git a/lib/AST/CMakeLists.txt b/lib/AST/CMakeLists.txt
index a0011d8a68c..13363dea4aa 100644
--- a/lib/AST/CMakeLists.txt
+++ b/lib/AST/CMakeLists.txt
@@ -125,7 +125,7 @@ add_swift_host_library(swiftAST STATIC
)
if(SWIFT_FORCE_OPTIMIZED_TYPECHECKER)
- if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC OR CMAKE_CXX_SIMULATE_ID STREQUAL MSVC)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
target_compile_options(swiftAST PRIVATE /O2 /Ob2)
else()
target_compile_options(swiftAST PRIVATE -O3)
diff --git a/lib/Migrator/CMakeLists.txt b/lib/Migrator/CMakeLists.txt
index 1dfd089d21a..228baa470ed 100644
--- a/lib/Migrator/CMakeLists.txt
+++ b/lib/Migrator/CMakeLists.txt
@@ -23,7 +23,7 @@ set(outputs)
foreach(input ${datafiles})
set(source "${CMAKE_CURRENT_SOURCE_DIR}/${input}")
set(dest "${output_dir}/${input}")
- if(CMAKE_SYSTEM_NAME STREQUAL Windows)
+ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(CMAKE_SYMLINK_COMMAND copy)
else()
set(CMAKE_SYMLINK_COMMAND create_symlink)
diff --git a/lib/Parse/CMakeLists.txt b/lib/Parse/CMakeLists.txt
index b46a4b217c3..b8550c96b2a 100644
--- a/lib/Parse/CMakeLists.txt
+++ b/lib/Parse/CMakeLists.txt
@@ -1,6 +1,6 @@
-if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(SWIFT_GYB_FLAGS --line-directive "^\"#line %(line)d \\\"%(file)s\\\"^\"")
else()
set(SWIFT_GYB_FLAGS --line-directive "\'#line" "%(line)d" "\"%(file)s\"\'")
diff --git a/lib/Sema/CMakeLists.txt b/lib/Sema/CMakeLists.txt
index c0e3608d07a..bf70a33782d 100644
--- a/lib/Sema/CMakeLists.txt
+++ b/lib/Sema/CMakeLists.txt
@@ -74,7 +74,7 @@ add_swift_host_library(swiftSema STATIC
TypeChecker.cpp
IDETypeCheckingRequests.cpp)
if(SWIFT_FORCE_OPTIMIZED_TYPECHECKER)
- if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC OR CMAKE_CXX_SIMULATE_ID STREQUAL MSVC)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
target_compile_options(swiftSema PRIVATE /O2 /Ob2)
else()
target_compile_options(swiftSema PRIVATE -O3)
diff --git a/lib/SwiftRemoteMirror/CMakeLists.txt b/lib/SwiftRemoteMirror/CMakeLists.txt
index f774297e51c..da2248de9f7 100644
--- a/lib/SwiftRemoteMirror/CMakeLists.txt
+++ b/lib/SwiftRemoteMirror/CMakeLists.txt
@@ -3,6 +3,6 @@ add_swift_host_library(swiftRemoteMirror STATIC
target_link_libraries(swiftRemoteMirror PRIVATE
swiftDemangling)
-if(CMAKE_SYSTEM_NAME STREQUAL Windows)
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(swiftRemoteMirror PRIVATE _LIB)
endif()
diff --git a/stdlib/cmake/modules/AddSwiftStdlib.cmake b/stdlib/cmake/modules/AddSwiftStdlib.cmake
index 25a79d145fb..781d6fd33cf 100644
--- a/stdlib/cmake/modules/AddSwiftStdlib.cmake
+++ b/stdlib/cmake/modules/AddSwiftStdlib.cmake
@@ -249,7 +249,7 @@ function(_add_target_variant_c_compile_flags)
# NOTE(compnerd) workaround LLVM invoking `add_definitions(-D_DEBUG)` which
# causes failures for the runtime library when cross-compiling due to
# undefined symbols from the standard library.
- if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
+ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND result "-U_DEBUG")
endif()
endif()
@@ -258,7 +258,7 @@ function(_add_target_variant_c_compile_flags)
# uses a spin lock for this, so to get reasonable behavior we have to
# implement it ourselves using _InterlockedCompareExchange128.
# clang-cl requires us to enable the `cx16` feature to use this intrinsic.
- if(CFLAGS_ARCH STREQUAL x86_64)
+ if(CFLAGS_ARCH STREQUAL "x86_64")
if(SWIFT_COMPILER_IS_MSVC_LIKE)
list(APPEND result /clang:-mcx16)
else()
@@ -287,7 +287,7 @@ function(_add_target_variant_c_compile_flags)
endif()
if("${CFLAGS_SDK}" STREQUAL "LINUX")
- if(${CFLAGS_ARCH} STREQUAL x86_64)
+ if("${CFLAGS_ARCH}" STREQUAL "x86_64")
# this is the minimum architecture that supports 16 byte CAS, which is necessary to avoid a dependency to libatomic
list(APPEND result "-march=core2")
endif()
@@ -493,7 +493,7 @@ function(_add_target_variant_link_flags)
else()
set(linker "${SWIFT_USE_LINKER}")
endif()
- if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
list(APPEND result "-fuse-ld=${linker}.exe")
else()
list(APPEND result "-fuse-ld=${linker}")
@@ -506,8 +506,8 @@ function(_add_target_variant_link_flags)
#
# TODO: Evaluate/enable -f{function,data}-sections --gc-sections for bfd,
# gold, and lld.
- if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
- if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
+ if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
# See rdar://48283130: This gives 6MB+ size reductions for swift and
# SourceKitService, and much larger size reductions for sil-opt etc.
list(APPEND result "-Wl,-dead_strip")
@@ -969,7 +969,7 @@ function(add_swift_target_library_single target name)
endif()
set(INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS ${SWIFTLIB_INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS})
- if(${libkind} STREQUAL "SHARED")
+ if(libkind STREQUAL "SHARED")
list(APPEND INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS
${SWIFTLIB_INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS_SHARED_ONLY})
endif()
@@ -991,7 +991,7 @@ function(add_swift_target_library_single target name)
# target_sources(${target}
# PRIVATE
# $<TARGET_OBJECTS:swiftImageRegistrationObject${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_OBJECT_FORMAT}-${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTLIB_SINGLE_ARCHITECTURE}>)
- if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS)
+ if(SWIFTLIB_SINGLE_SDK STREQUAL "WINDOWS")
set(extension .obj)
else()
set(extension .o)
@@ -1059,8 +1059,8 @@ function(add_swift_target_library_single target name)
set_target_properties("${target}" PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${swiftlib_prefix}/${output_sub_dir}
ARCHIVE_OUTPUT_DIRECTORY ${swiftlib_prefix}/${output_sub_dir})
- if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS AND SWIFTLIB_SINGLE_IS_STDLIB_CORE
- AND libkind STREQUAL SHARED)
+ if(SWIFTLIB_SINGLE_SDK STREQUAL "WINDOWS" AND SWIFTLIB_SINGLE_IS_STDLIB_CORE
+ AND libkind STREQUAL "SHARED")
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${target}> ${swiftlib_prefix}/${output_sub_dir})
endif()
@@ -1264,8 +1264,8 @@ function(add_swift_target_library_single target name)
MACCATALYST_BUILD_FLAVOR "${SWIFTLIB_SINGLE_MACCATALYST_BUILD_FLAVOR}"
)
- if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS)
- if(libkind STREQUAL SHARED)
+ if(SWIFTLIB_SINGLE_SDK STREQUAL "WINDOWS")
+ if(libkind STREQUAL "SHARED")
list(APPEND c_compile_flags -D_WINDLL)
endif()
endif()
@@ -1324,13 +1324,13 @@ function(add_swift_target_library_single target name)
endif()
# Set compilation and link flags.
- if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS)
+ if(SWIFTLIB_SINGLE_SDK STREQUAL "WINDOWS")
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE}
${SWIFTLIB_SINGLE_ARCHITECTURE}_INCLUDE)
target_include_directories(${target} SYSTEM PRIVATE
${${SWIFTLIB_SINGLE_ARCHITECTURE}_INCLUDE})
- if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL MSVC)
+ if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
swift_windows_get_sdk_vfs_overlay(SWIFTLIB_SINGLE_VFS_OVERLAY)
target_compile_options(${target} PRIVATE
"SHELL:-Xclang -ivfsoverlay -Xclang ${SWIFTLIB_SINGLE_VFS_OVERLAY}")
@@ -1347,7 +1347,7 @@ function(add_swift_target_library_single target name)
${c_compile_flags})
target_link_options(${target} PRIVATE
${link_flags})
- if(${SWIFTLIB_SINGLE_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
+ if(SWIFTLIB_SINGLE_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
target_link_options(${target} PRIVATE
"LINKER:-compatibility_version,1")
if(SWIFT_COMPILER_VERSION)
@@ -1380,7 +1380,7 @@ function(add_swift_target_library_single target name)
list(APPEND swiftlib_link_flags_all "-Xlinker -no_warn_inits")
endif()
- if(${SWIFTLIB_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
+ if(SWIFTLIB_SINGLE_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
# In the past, we relied on unsetting globally
# CMAKE_OSX_ARCHITECTURES to ensure that CMake
# would not add the -arch flag. This is no longer
@@ -1403,7 +1403,7 @@ function(add_swift_target_library_single target name)
# doing so will result in incorrect symbol resolution and linkage. We created
# import library targets when the library was added. Use that to adjust the
# link libraries.
- if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS AND NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
+ if(SWIFTLIB_SINGLE_SDK STREQUAL "WINDOWS" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
foreach(library_list LINK_LIBRARIES PRIVATE_LINK_LIBRARIES)
set(import_libraries)
foreach(library ${SWIFTLIB_SINGLE_${library_list}})
@@ -1415,7 +1415,7 @@ function(add_swift_target_library_single target name)
set(import_library ${library})
if(TARGET ${library})
get_target_property(type ${library} TYPE)
- if(${type} STREQUAL "SHARED_LIBRARY")
+ if(type STREQUAL "SHARED_LIBRARY")
set(import_library ${library}_IMPLIB)
endif()
endif()
@@ -1744,7 +1744,7 @@ function(add_swift_target_library name)
list(APPEND SWIFTLIB_SWIFT_MODULE_DEPENDS Core)
# swiftSwiftOnoneSupport does not depend on itself, obviously.
- if(NOT ${name} STREQUAL swiftSwiftOnoneSupport)
+ if(NOT name STREQUAL "swiftSwiftOnoneSupport")
# All Swift code depends on the SwiftOnoneSupport in non-optimized mode,
# except for the standard library itself.
is_build_type_optimized("${SWIFT_STDLIB_BUILD_TYPE}" optimized)
@@ -1851,7 +1851,7 @@ function(add_swift_target_library name)
# Collect architecture agnostic SDK module dependencies
set(swiftlib_module_depends_flattened ${SWIFTLIB_SWIFT_MODULE_DEPENDS})
- if(${sdk} STREQUAL OSX)
+ if(sdk STREQUAL "OSX")
if(DEFINED maccatalyst_build_flavor AND NOT maccatalyst_build_flavor STREQUAL "macos-like")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_MACCATALYST})
@@ -1863,70 +1863,70 @@ function(add_swift_target_library name)
endif()
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_OSX})
- elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR)
+ elseif(sdk STREQUAL "IOS" OR sdk STREQUAL "IOS_SIMULATOR")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_IOS})
- elseif(${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
+ elseif(sdk STREQUAL "TVOS" OR sdk STREQUAL "TVOS_SIMULATOR")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_TVOS})
- elseif(${sdk} STREQUAL WATCHOS OR ${sdk} STREQUAL WATCHOS_SIMULATOR)
+ elseif(sdk STREQUAL "WATCHOS" OR sdk STREQUAL "WATCHOS_SIMULATOR")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_WATCHOS})
- elseif(${sdk} STREQUAL FREESTANDING)
+ elseif(sdk STREQUAL "FREESTANDING")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_FREESTANDING})
- elseif(${sdk} STREQUAL FREEBSD)
+ elseif(sdk STREQUAL "FREEBSD")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_FREEBSD})
- elseif(${sdk} STREQUAL OPENBSD)
+ elseif(sdk STREQUAL "OPENBSD")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_OPENBSD})
- elseif(${sdk} STREQUAL LINUX OR ${sdk} STREQUAL ANDROID)
+ elseif(sdk STREQUAL "LINUX" OR sdk STREQUAL "ANDROID")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_LINUX})
- elseif(${sdk} STREQUAL CYGWIN)
+ elseif(sdk STREQUAL "CYGWIN")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_CYGWIN})
- elseif(${sdk} STREQUAL HAIKU)
+ elseif(sdk STREQUAL "HAIKU")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_HAIKU})
- elseif(${sdk} STREQUAL WASI)
+ elseif(sdk STREQUAL "WASI")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_WASI})
- elseif(${sdk} STREQUAL WINDOWS)
+ elseif(sdk STREQUAL "WINDOWS")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_WINDOWS})
endif()
# Collect architecture agnostic SDK framework dependencies
set(swiftlib_framework_depends_flattened ${SWIFTLIB_FRAMEWORK_DEPENDS})
- if(${sdk} STREQUAL OSX)
+ if(sdk STREQUAL "OSX")
list(APPEND swiftlib_framework_depends_flattened
${SWIFTLIB_FRAMEWORK_DEPENDS_OSX})
- elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR OR
- ${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
+ elseif(sdk STREQUAL "IOS" OR sdk STREQUAL "IOS_SIMULATOR" OR
+ sdk STREQUAL "TVOS" OR sdk STREQUAL "TVOS_SIMULATOR")
list(APPEND swiftlib_framework_depends_flattened
${SWIFTLIB_FRAMEWORK_DEPENDS_IOS_TVOS})
endif()
# Collect architecture agnostic swift compiler flags
set(swiftlib_swift_compile_flags_all ${SWIFTLIB_SWIFT_COMPILE_FLAGS})
- if(${sdk} STREQUAL OSX)
+ if(sdk STREQUAL "OSX")
list(APPEND swiftlib_swift_compile_flags_all
${SWIFTLIB_SWIFT_COMPILE_FLAGS_OSX})
- elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR)
+ elseif(sdk STREQUAL "IOS" OR sdk STREQUAL "IOS_SIMULATOR")
list(APPEND swiftlib_swift_compile_flags_all
${SWIFTLIB_SWIFT_COMPILE_FLAGS_IOS})
- elseif(${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
+ elseif(sdk STREQUAL "TVOS" OR sdk STREQUAL "TVOS_SIMULATOR")
list(APPEND swiftlib_swift_compile_flags_all
${SWIFTLIB_SWIFT_COMPILE_FLAGS_TVOS})
- elseif(${sdk} STREQUAL WATCHOS OR ${sdk} STREQUAL WATCHOS_SIMULATOR)
+ elseif(sdk STREQUAL "WATCHOS" OR sdk STREQUAL "WATCHOS_SIMULATOR")
list(APPEND swiftlib_swift_compile_flags_all
${SWIFTLIB_SWIFT_COMPILE_FLAGS_WATCHOS})
- elseif(${sdk} STREQUAL LINUX)
+ elseif(sdk STREQUAL "LINUX")
list(APPEND swiftlib_swift_compile_flags_all
${SWIFTLIB_SWIFT_COMPILE_FLAGS_LINUX})
- elseif(${sdk} STREQUAL WINDOWS)
+ elseif(sdk STREQUAL "WINDOWS")
# FIXME: https://github.com/apple/swift/issues/44614
# static and shared are not mutually exclusive; however since we do a
# single build of the sources, this doesn't work for building both
@@ -1945,7 +1945,7 @@ function(add_swift_target_library name)
# Collect architecture agnostic SDK linker flags
set(swiftlib_link_flags_all ${SWIFTLIB_LINK_FLAGS})
- if(${sdk} STREQUAL IOS_SIMULATOR AND ${name} STREQUAL swiftMediaPlayer)
+ if(sdk STREQUAL "IOS_SIMULATOR" AND name STREQUAL "swiftMediaPlayer")
# message("DISABLING AUTOLINK FOR swiftMediaPlayer")
list(APPEND swiftlib_link_flags_all "-Xlinker" "-ignore_auto_link")
endif()
@@ -1959,8 +1959,8 @@ function(add_swift_target_library name)
# back to supported targets and libraries only. This is needed for ELF
# targets only; however, RemoteMirror needs to build with undefined
# symbols.
- if(${SWIFT_SDK_${sdk}_OBJECT_FORMAT} STREQUAL ELF AND
- NOT ${name} STREQUAL swiftRemoteMirror)
+ if(SWIFT_SDK_${sdk}_OBJECT_FORMAT STREQUAL "ELF" AND
+ NOT name STREQUAL "swiftRemoteMirror")
list(APPEND swiftlib_link_flags_all "-Wl,-z,defs")
endif()
# Setting back linker flags which are not supported when making Android build on macOS cross-compile host.
@@ -2067,22 +2067,22 @@ function(add_swift_target_library name)
set(swiftlib_link_flags_all ${SWIFTLIB_LINK_FLAGS})
# Collect architecture agnostic c compiler flags
- if(${sdk} STREQUAL OSX)
+ if(sdk STREQUAL "OSX")
list(APPEND swiftlib_c_compile_flags_all
${SWIFTLIB_C_COMPILE_FLAGS_OSX})
- elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR)
+ elseif(sdk STREQUAL "IOS" OR sdk STREQUAL "IOS_SIMULATOR")
list(APPEND swiftlib_c_compile_flags_all
${SWIFTLIB_C_COMPILE_FLAGS_IOS})
- elseif(${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
+ elseif(sdk STREQUAL "TVOS" OR sdk STREQUAL "TVOS_SIMULATOR")
list(APPEND swiftlib_c_compile_flags_all
${SWIFTLIB_C_COMPILE_FLAGS_TVOS})
- elseif(${sdk} STREQUAL WATCHOS OR ${sdk} STREQUAL WATCHOS_SIMULATOR)
+ elseif(sdk STREQUAL "WATCHOS" OR sdk STREQUAL "WATCHOS_SIMULATOR")
list(APPEND swiftlib_c_compile_flags_all
${SWIFTLIB_C_COMPILE_FLAGS_WATCHOS})
- elseif(${sdk} STREQUAL LINUX)
+ elseif(sdk STREQUAL "LINUX")
list(APPEND swiftlib_c_compile_flags_all
${SWIFTLIB_C_COMPILE_FLAGS_LINUX})
- elseif(${sdk} STREQUAL WINDOWS)
+ elseif(sdk STREQUAL "WINDOWS")
list(APPEND swiftlib_c_compile_flags_all
${SWIFTLIB_C_COMPILE_FLAGS_WINDOWS})
endif()
@@ -2124,7 +2124,7 @@ function(add_swift_target_library name)
endif()
# Setting back linker flags which are not supported when making Android build on macOS cross-compile host.
- if(SWIFTLIB_SHARED AND ${sdk} STREQUAL ANDROID)
+ if(SWIFTLIB_SHARED AND sdk STREQUAL "ANDROID")
list(APPEND swiftlib_link_flags_all "-shared")
# TODO: Instead of `lib${name}.so` find variable or target property which already have this value.
list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so")
@@ -2181,7 +2181,7 @@ function(add_swift_target_library name)
add_dependencies(${VARIANT_NAME} clang)
endif()
- if(sdk STREQUAL WINDOWS)
+ if(sdk STREQUAL "WINDOWS")
if(SWIFT_COMPILER_IS_MSVC_LIKE)
if (SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY MATCHES MultiThreadedDebugDLL)
target_compile_options(${VARIANT_NAME} PRIVATE /MDd /D_DLL /D_DEBUG)
@@ -2326,7 +2326,7 @@ function(add_swift_target_library name)
set(optional_arg "OPTIONAL")
endif()
- if(sdk STREQUAL WINDOWS AND CMAKE_SYSTEM_NAME STREQUAL Windows)
+ if(sdk STREQUAL "WINDOWS" AND CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_dependencies(${SWIFTLIB_INSTALL_IN_COMPONENT} ${name}-windows-${SWIFT_PRIMARY_VARIANT_ARCH})
swift_install_in_component(TARGETS ${name}-windows-${SWIFT_PRIMARY_VARIANT_ARCH}
RUNTIME
@@ -2357,7 +2357,7 @@ function(add_swift_target_library name)
PERMISSIONS ${file_permissions}
"${optional_arg}")
endif()
- if(sdk STREQUAL WINDOWS)
+ if(sdk STREQUAL "WINDOWS")
foreach(arch ${SWIFT_SDK_WINDOWS_ARCHITECTURES})
if(TARGET ${name}-windows-${arch}_IMPLIB)
get_target_property(import_library ${name}-windows-${arch}_IMPLIB IMPORTED_LOCATION)
@@ -2558,13 +2558,13 @@ function(_add_swift_target_executable_single name)
${SWIFTEXE_SINGLE_DEPENDS})
llvm_update_compile_flags("${name}")
- if(SWIFTEXE_SINGLE_SDK STREQUAL WINDOWS)
+ if(SWIFTEXE_SINGLE_SDK STREQUAL "WINDOWS")
swift_windows_include_for_arch(${SWIFTEXE_SINGLE_ARCHITECTURE}
${SWIFTEXE_SINGLE_ARCHITECTURE}_INCLUDE)
target_include_directories(${name} SYSTEM PRIVATE
${${SWIFTEXE_SINGLE_ARCHITECTURE}_INCLUDE})
- if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL MSVC)
+ if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
# MSVC doesn't support -Xclang. We don't need to manually specify
# the dependent libraries as `cl` does so.
target_compile_options(${name} PRIVATE
@@ -2584,7 +2584,7 @@ function(_add_swift_target_executable_single name)
if (SWIFT_PARALLEL_LINK_JOBS)
set_property(TARGET ${name} PROPERTY JOB_POOL_LINK swift_link_job_pool)
endif()
- if(${SWIFTEXE_SINGLE_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
+ if(SWIFTEXE_SINGLE_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
set_target_properties(${name} PROPERTIES
BUILD_WITH_INSTALL_RPATH YES
INSTALL_RPATH "@executable_path/../lib/swift/${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}")
@@ -2596,7 +2596,7 @@ function(_add_swift_target_executable_single name)
# NOTE(compnerd) use the C linker language to invoke `clang` rather than
# `clang++` as we explicitly link against the C++ runtime. We were previously
# actually passing `-nostdlib++` to avoid the C++ runtime linkage.
- if(${SWIFTEXE_SINGLE_SDK} STREQUAL ANDROID)
+ if(SWIFTEXE_SINGLE_SDK STREQUAL "ANDROID")
set_property(TARGET "${name}" PROPERTY
LINKER_LANGUAGE "C")
else()
@@ -2666,7 +2666,7 @@ function(add_swift_target_executable name)
EXCLUDE_FROM_ALL TRUE)
endif()
- if(${sdk} IN_LIST SWIFT_APPLE_PLATFORMS)
+ if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
# In the past, we relied on unsetting globally
# CMAKE_OSX_ARCHITECTURES to ensure that CMake would
# not add the -arch flag
diff --git a/stdlib/cmake/modules/SwiftSource.cmake b/stdlib/cmake/modules/SwiftSource.cmake
index d5d57dfd18a..39c2e07860f 100644
--- a/stdlib/cmake/modules/SwiftSource.cmake
+++ b/stdlib/cmake/modules/SwiftSource.cmake
@@ -730,7 +730,7 @@ function(_compile_swift_files
set(line_directive_tool "${SWIFT_SOURCE_DIR}/utils/line-directive")
- if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(HOST_EXECUTABLE_SUFFIX .exe)
endif()
if(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
@@ -748,7 +748,7 @@ function(_compile_swift_files
"${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc${HOST_EXECUTABLE_SUFFIX}"
"${SWIFTFILE_BOOTSTRAPPING}")
- if(NOT ${SWIFTFILE_BOOTSTRAPPING} STREQUAL "")
+ if(NOT "${SWIFTFILE_BOOTSTRAPPING}" STREQUAL "")
set(target_suffix "-bootstrapping${SWIFTFILE_BOOTSTRAPPING}")
endif()
@@ -786,7 +786,7 @@ function(_compile_swift_files
# When building the stdlib with bootstrapping, the compiler needs
# to pick up the stdlib from the previous bootstrapping stage, because the
# stdlib in the current stage is not built yet.
- if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
+ if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
set(set_environment_args "${CMAKE_COMMAND}" "-E" "env" "DYLD_LIBRARY_PATH=${bs_lib_dir}")
elseif(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD")
set(set_environment_args "${CMAKE_COMMAND}" "-E" "env" "LD_LIBRARY_PATH=${bs_lib_dir}")
diff --git a/stdlib/public/Concurrency/CMakeLists.txt b/stdlib/public/Concurrency/CMakeLists.txt
index ff614adce76..76e0694a731 100644
--- a/stdlib/public/Concurrency/CMakeLists.txt
+++ b/stdlib/public/Concurrency/CMakeLists.txt
@@ -26,14 +26,14 @@ set(SWIFT_RUNTIME_CONCURRENCY_C_FLAGS)
set(SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS)
set(swift_concurrency_private_link_libraries)
-if(CMAKE_SYSTEM_NAME STREQUAL Windows)
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND swift_concurrency_private_link_libraries Synchronization)
endif()
set(swift_concurrency_incorporate_object_libraries_so swiftThreading)
if("${SWIFT_CONCURRENCY_GLOBAL_EXECUTOR}" STREQUAL "dispatch")
- if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
include_directories(AFTER
${SWIFT_PATH_TO_LIBDISPATCH_SOURCE})
@@ -61,7 +61,7 @@ endif()
# Don't emit extended frame info on platforms other than darwin, system
# backtracer and system debugger are unlikely to support it.
-if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS
"-fswift-async-fp=${swift_concurrency_async_fp_mode}")
list(APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS
diff --git a/stdlib/public/Cxx/std/CMakeLists.txt b/stdlib/public/Cxx/std/CMakeLists.txt
index f24d08b6b62..b805b2ed6cb 100644
--- a/stdlib/public/Cxx/std/CMakeLists.txt
+++ b/stdlib/public/Cxx/std/CMakeLists.txt
@@ -1,6 +1,6 @@
set(libstdcxx_modulemap_target_list)
foreach(sdk ${SWIFT_SDKS})
- if(NOT ${sdk} IN_LIST SWIFT_LIBSTDCXX_PLATFORMS)
+ if(NOT sdk IN_LIST SWIFT_LIBSTDCXX_PLATFORMS)
continue()
endif()
@@ -86,7 +86,7 @@ foreach(sdk ${SWIFT_SDKS})
COMPONENT sdk-overlay)
endif()
- if(${BOOTSTRAPPING_MODE} MATCHES "BOOTSTRAPPING.*")
+ if(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
foreach(bootstrapping "0" "1")
get_bootstrapping_path(bootstrapping_dir ${module_dir} ${bootstrapping})
set(libstdcxx_modulemap_out_bootstrapping "${bootstrapping_dir}/libstdcxx.modulemap")
diff --git a/stdlib/public/Platform/CMakeLists.txt b/stdlib/public/Platform/CMakeLists.txt
index 9063931bd20..757a89eb760 100644
--- a/stdlib/public/Platform/CMakeLists.txt
+++ b/stdlib/public/Platform/CMakeLists.txt
@@ -42,8 +42,8 @@ set(swiftDarwin_common_options
DEPENDS ${darwin_depends})
-if(${BOOTSTRAPPING_MODE} STREQUAL "BOOTSTRAPPING" AND
- ${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
+if(BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING" AND
+ SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
set(swiftDarwin_common_bootstrapping_options
${swiftDarwin_common_options}
@@ -179,7 +179,7 @@ foreach(sdk ${SWIFT_SDKS})
# with its own native sysroot, create a native modulemap without a sysroot
# prefix. This is the one we'll install instead.
if(NOT "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${arch}_PATH}" STREQUAL "/" AND
- NOT (${sdk} STREQUAL ANDROID AND NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL ""))
+ NOT (sdk STREQUAL "ANDROID" AND NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL ""))
set(glibc_sysroot_relative_modulemap_out "${module_dir}/sysroot-relative-modulemaps/glibc.modulemap")
handle_gyb_source_single(glibc_modulemap_native_target
diff --git a/stdlib/public/SwiftOnoneSupport/CMakeLists.txt b/stdlib/public/SwiftOnoneSupport/CMakeLists.txt
index 50efa52b7e1..cf6f09bcf69 100644
--- a/stdlib/public/SwiftOnoneSupport/CMakeLists.txt
+++ b/stdlib/public/SwiftOnoneSupport/CMakeLists.txt
@@ -10,7 +10,7 @@ set(swiftOnoneSupport_common_options
SWIFT_COMPILE_FLAGS "-parse-stdlib" "-Xllvm" "-sil-inline-generics=false" "-Xfrontend" "-validate-tbd-against-ir=none" "-Xfrontend" "-check-onone-completeness" "-Xfrontend" "-disable-access-control" "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}"
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}")
-if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ${BOOTSTRAPPING_MODE} STREQUAL "BOOTSTRAPPING")
+if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING")
set(swiftOnoneSupport_common_bootstrapping_options
SHARED
diff --git a/stdlib/public/SwiftShims/swift/shims/CMakeLists.txt b/stdlib/public/SwiftShims/swift/shims/CMakeLists.txt
index c54b2cf84b2..f925940d8a2 100644
--- a/stdlib/public/SwiftShims/swift/shims/CMakeLists.txt
+++ b/stdlib/public/SwiftShims/swift/shims/CMakeLists.txt
@@ -152,7 +152,7 @@ if(NOT SWIFT_BUILT_STANDALONE)
endforeach()
endif()
-if(${BOOTSTRAPPING_MODE} MATCHES "BOOTSTRAPPING.*")
+if(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
foreach(bootstrapping "0" "1")
get_bootstrapping_path(outdir ${SWIFTLIB_DIR} ${bootstrapping})
set(target_name "symlink-headers-bootstrapping${bootstrapping}")
diff --git a/stdlib/public/core/CMakeLists.txt b/stdlib/public/core/CMakeLists.txt
index c2217c9f294..be0d826b29d 100644
--- a/stdlib/public/core/CMakeLists.txt
+++ b/stdlib/public/core/CMakeLists.txt
@@ -251,18 +251,18 @@ set(swift_core_framework_depends)
set(swift_core_private_link_libraries)
set(swift_stdlib_compile_flags "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}")
-if(SWIFT_PRIMARY_VARIANT_SDK STREQUAL CYGWIN)
+if(SWIFT_PRIMARY_VARIANT_SDK STREQUAL "CYGWIN")
# TODO(compnerd) cache this variable to permit re-configuration
execute_process(COMMAND "cygpath" "-u" "$ENV{SYSTEMROOT}" OUTPUT_VARIABLE ENV_SYSTEMROOT)
list(APPEND swift_core_private_link_libraries "${ENV_SYSTEMROOT}/system32/psapi.dll")
-elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL FREEBSD)
+elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL "FREEBSD")
find_library(EXECINFO_LIBRARY execinfo)
list(APPEND swift_core_private_link_libraries ${EXECINFO_LIBRARY})
-elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL LINUX)
+elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL "LINUX")
if(SWIFT_BUILD_STATIC_STDLIB)
list(APPEND swift_core_private_link_libraries)
endif()
-elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL WINDOWS)
+elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL "WINDOWS")
list(APPEND swift_core_private_link_libraries shell32;DbgHelp;Synchronization)
endif()
@@ -331,7 +331,7 @@ set(swiftCore_common_options
set(swiftCore_common_dependencies
copy_shim_headers "${SWIFTLIB_DIR}/shims" ${GROUP_INFO_JSON_FILE})
-if(${BOOTSTRAPPING_MODE} STREQUAL "BOOTSTRAPPING")
+if(BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING")
set(b0_deps symlink-headers-bootstrapping0)
set(b1_deps symlink-headers-bootstrapping1)
diff --git a/stdlib/public/runtime/CMakeLists.txt b/stdlib/public/runtime/CMakeLists.txt
index e46c37d626b..db503543b6b 100644
--- a/stdlib/public/runtime/CMakeLists.txt
+++ b/stdlib/public/runtime/CMakeLists.txt
@@ -163,7 +163,7 @@ foreach(sdk ${SWIFT_SDKS})
# set(swiftrtObject "$<TARGET_OBJECTS:swiftImageRegistrationObject${SWIFT_SDK_${sdk}_OBJECT_FORMAT}-${arch_suffix}>")
set(swiftrtObject ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/swiftImageRegistrationObject${SWIFT_SDK_${sdk}_OBJECT_FORMAT}-${arch_suffix}.dir/SwiftRT-${SWIFT_SDK_${sdk}_OBJECT_FORMAT}.cpp${CMAKE_C_OUTPUT_EXTENSION})
- if(sdk STREQUAL WINDOWS)
+ if(sdk STREQUAL "WINDOWS")
set(extension .obj)
else()
set(extension .o)
@@ -209,12 +209,12 @@ foreach(sdk ${SWIFT_SDKS})
# Generate the static-stdlib-args.lnk file used by -static-stdlib option for
# 'GenericUnix' (eg linux)
- if(${SWIFT_SDK_${sdk}_OBJECT_FORMAT} STREQUAL ELF)
+ if(SWIFT_SDK_${sdk}_OBJECT_FORMAT STREQUAL "ELF")
string(TOLOWER "${sdk}" lowercase_sdk)
set(libpthread -lpthread)
set(concurrency_libs)
set(android_libraries)
- if(${sdk} STREQUAL ANDROID)
+ if(sdk STREQUAL "ANDROID")
set(android_libraries -llog)
set(libpthread)
elseif(SWIFT_CONCURRENCY_USES_DISPATCH)
diff --git a/stdlib/toolchain/legacy_layouts/CMakeLists.txt b/stdlib/toolchain/legacy_layouts/CMakeLists.txt
index ad18c6b1b32..96da3906821 100644
--- a/stdlib/toolchain/legacy_layouts/CMakeLists.txt
+++ b/stdlib/toolchain/legacy_layouts/CMakeLists.txt
@@ -55,7 +55,7 @@ foreach(sdk ${SWIFT_SDKS})
endforeach()
endforeach()
-if(${BOOTSTRAPPING_MODE} MATCHES "BOOTSTRAPPING.*")
+if(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
# The resource dir for bootstrapping0 may be used explicitly
# to cross compile for other architectures, so we would need
# to have all the legacy layouts in there
diff --git a/tools/SourceKit/CMakeLists.txt b/tools/SourceKit/CMakeLists.txt
index f87720f9c80..6c0c0800bc4 100644
--- a/tools/SourceKit/CMakeLists.txt
+++ b/tools/SourceKit/CMakeLists.txt
@@ -82,7 +82,7 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
# Add deployment target to C/C++ compiler and linker flags.
# FIXME: CMAKE_OSX_DEPLOYMENT_TARGET falls over when used for iOS versions.
if (XCODE)
- if (${SOURCEKIT_DEPLOYMENT_OS} MATCHES "^macosx")
+ if (SOURCEKIT_DEPLOYMENT_OS MATCHES "^macosx")
set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET ${SOURCEKIT_DEPLOYMENT_TARGET})
else()
set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${SOURCEKIT_DEPLOYMENT_TARGET})
@@ -101,7 +101,7 @@ if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
endif()
if(SWIFT_BUILD_HOST_DISPATCH)
- if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "WINDOWS")
set(SOURCEKIT_RUNTIME_DIR bin)
else()
set(SOURCEKIT_RUNTIME_DIR lib)
@@ -114,7 +114,7 @@ if(SWIFT_BUILD_HOST_DISPATCH)
DESTINATION ${SOURCEKIT_RUNTIME_DIR}
COMPONENT sourcekit-inproc)
endif()
- if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "WINDOWS")
swift_install_in_component(FILES
$<TARGET_LINKER_FILE:dispatch>
$<TARGET_LINKER_FILE:BlocksRuntime>
diff --git a/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake b/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
index 14d9a99a13a..bc26b263848 100644
--- a/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
+++ b/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
@@ -8,7 +8,7 @@ function(add_sourcekit_default_compiler_flags target)
_add_host_variant_link_flags(${target})
# Set compilation and link flags.
- if(${SWIFT_HOST_VARIANT_SDK} STREQUAL WINDOWS)
+ if(SWIFT_HOST_VARIANT_SDK STREQUAL "WINDOWS")
swift_windows_include_for_arch(${SWIFT_HOST_VARIANT_ARCH}
${SWIFT_HOST_VARIANT_ARCH}_INCLUDE)
target_include_directories(${target} SYSTEM PRIVATE
@@ -30,7 +30,7 @@ function(add_sourcekit_swift_runtime_link_flags target path HAS_SWIFT_MODULES)
endif()
endif()
- if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
+ if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
# Lists of rpaths that we are going to add to our executables.
#
@@ -118,7 +118,7 @@ function(add_sourcekit_swift_runtime_link_flags target path HAS_SWIFT_MODULES)
elseif(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD" AND HAS_SWIFT_MODULES AND ASKD_BOOTSTRAPPING_MODE)
set(swiftrt "swiftImageRegistrationObject${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_OBJECT_FORMAT}-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}-${SWIFT_HOST_VARIANT_ARCH}")
- if(${ASKD_BOOTSTRAPPING_MODE} MATCHES "HOSTTOOLS|CROSSCOMPILE")
+ if(ASKD_BOOTSTRAPPING_MODE MATCHES "HOSTTOOLS|CROSSCOMPILE")
# At build time and run time, link against the swift libraries in the
# installed host toolchain.
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
@@ -163,7 +163,7 @@ function(add_sourcekit_swift_runtime_link_flags target path HAS_SWIFT_MODULES)
# able to fall back to the SDK directory for libswiftCore et al.
if (BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
if (NOT "${bootstrapping}" STREQUAL "1")
- if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
+ if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
target_link_directories(${target} PRIVATE "${sdk_dir}")
# Include the abi stable system stdlib in our rpath.
diff --git a/tools/SourceKit/lib/Support/CMakeLists.txt b/tools/SourceKit/lib/Support/CMakeLists.txt
index c4e2cbcd31e..a47b2347a12 100644
--- a/tools/SourceKit/lib/Support/CMakeLists.txt
+++ b/tools/SourceKit/lib/Support/CMakeLists.txt
@@ -9,7 +9,7 @@ target_link_libraries(SourceKitSupport PRIVATE
swiftBasic
clangBasic
clangRewrite)
-if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_libraries(SourceKitSupport INTERFACE
dispatch
BlocksRuntime)
diff --git a/tools/SourceKit/tools/complete-test/CMakeLists.txt b/tools/SourceKit/tools/complete-test/CMakeLists.txt
index ec3437650a0..d1b3fe3b36a 100644
--- a/tools/SourceKit/tools/complete-test/CMakeLists.txt
+++ b/tools/SourceKit/tools/complete-test/CMakeLists.txt
@@ -7,13 +7,13 @@ if(SWIFT_SOURCEKIT_USE_INPROC_LIBRARY)
else()
target_link_libraries(complete-test PRIVATE sourcekitd)
endif()
-if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_libraries(complete-test PRIVATE
dispatch
BlocksRuntime)
endif()
-if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_target_properties(complete-test PROPERTIES
INSTALL_RPATH "@executable_path/../lib")
target_link_options(complete-test PRIVATE
diff --git a/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt b/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt
index d4a3a77df2a..f537ad74544 100644
--- a/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt
+++ b/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt
@@ -7,7 +7,7 @@ if(SWIFT_SOURCEKIT_USE_INPROC_LIBRARY)
else()
target_link_libraries(sourcekitd-repl PRIVATE sourcekitd)
endif()
-if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_libraries(sourcekitd-repl PRIVATE
dispatch
BlocksRuntime)
@@ -15,7 +15,7 @@ endif()
target_link_libraries(sourcekitd-repl PRIVATE
libedit)
-if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_target_properties(sourcekitd-repl PROPERTIES
INSTALL_RPATH "@executable_path/../lib")
target_link_options(sourcekitd-repl PRIVATE
diff --git a/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt b/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt
index 91c28f371c4..e5f7aa5c9fb 100644
--- a/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt
+++ b/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt
@@ -17,7 +17,7 @@ if(SWIFT_SOURCEKIT_USE_INPROC_LIBRARY)
else()
target_link_libraries(sourcekitd-test PRIVATE sourcekitd)
endif()
-if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_libraries(sourcekitd-test PRIVATE
dispatch
BlocksRuntime)
@@ -25,7 +25,7 @@ endif()
add_dependencies(sourcekitd-test sourcekitdTestOptionsTableGen)
-if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_target_properties(sourcekitd-test PROPERTIES
INSTALL_RPATH "@executable_path/../lib")
target_link_options(sourcekitd-test PRIVATE
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
index 4521356ffc6..ab6dad7b273 100644
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -10,7 +10,7 @@ function(add_swift_parser_link_libraries target)
endif()
endfunction()
-if(${BOOTSTRAPPING_MODE} MATCHES "BOOTSTRAPPING.*")
+if(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
# Bootstrapping - level 0
# For more information on how bootstrapping works, see docs/SwiftInTheCompiler.md
diff --git a/tools/libSwiftScan/CMakeLists.txt b/tools/libSwiftScan/CMakeLists.txt
index f11c2a99758..93beb4629b0 100644
--- a/tools/libSwiftScan/CMakeLists.txt
+++ b/tools/libSwiftScan/CMakeLists.txt
@@ -8,7 +8,7 @@ add_swift_host_library(libSwiftScan SHARED
libSwiftScan.cpp
c-include-check.c)
-if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
+if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
# Workaround for a linker crash related to autolinking: rdar://77839981
set_property(TARGET libSwiftScan APPEND_STRING PROPERTY
LINK_FLAGS " -lobjc ")
diff --git a/unittests/Basic/CMakeLists.txt b/unittests/Basic/CMakeLists.txt
index 547751e6cac..10b413ce732 100644
--- a/unittests/Basic/CMakeLists.txt
+++ b/unittests/Basic/CMakeLists.txt
@@ -49,6 +49,6 @@ target_link_libraries(SwiftBasicTests
LLVMTestingSupport
)
-if(SWIFT_HOST_VARIANT STREQUAL windows)
+if(SWIFT_HOST_VARIANT STREQUAL "windows")
target_link_libraries(SwiftBasicTests PRIVATE Synchronization)
endif()
diff --git a/unittests/Threading/CMakeLists.txt b/unittests/Threading/CMakeLists.txt
index 5e0f27c089d..239630d038c 100644
--- a/unittests/Threading/CMakeLists.txt
+++ b/unittests/Threading/CMakeLists.txt
@@ -14,7 +14,7 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
swiftCore${SWIFT_PRIMARY_VARIANT_SUFFIX}
)
- if(SWIFT_HOST_VARIANT STREQUAL windows)
+ if(SWIFT_HOST_VARIANT STREQUAL "windows")
target_link_libraries(SwiftThreadingTests PRIVATE Synchronization)
endif()
endif()
diff --git a/unittests/runtime/CMakeLists.txt b/unittests/runtime/CMakeLists.txt
index 79df463c0ed..cef40263785 100644
--- a/unittests/runtime/CMakeLists.txt
+++ b/unittests/runtime/CMakeLists.txt
@@ -63,7 +63,7 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
list(APPEND PLATFORM_TARGET_LINK_LIBRARIES
${EXECINFO_LIBRARY}
)
- elseif(SWIFT_HOST_VARIANT STREQUAL windows)
+ elseif(SWIFT_HOST_VARIANT STREQUAL "windows")
list(APPEND PLATFORM_TARGET_LINK_LIBRARIES DbgHelp;Synchronization)
endif()
diff --git a/unittests/runtime/LongTests/CMakeLists.txt b/unittests/runtime/LongTests/CMakeLists.txt
index 592e532f8cf..37b5e00714e 100644
--- a/unittests/runtime/LongTests/CMakeLists.txt
+++ b/unittests/runtime/LongTests/CMakeLists.txt
@@ -30,7 +30,7 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
list(APPEND PLATFORM_TARGET_LINK_LIBRARIES
${EXECINFO_LIBRARY}
)
- elseif(SWIFT_HOST_VARIANT STREQUAL windows)
+ elseif(SWIFT_HOST_VARIANT STREQUAL "windows")
list(APPEND PLATFORM_TARGET_LINK_LIBRARIES DbgHelp;Synchronization)
endif()
diff --git a/utils/api_checker/CMakeLists.txt b/utils/api_checker/CMakeLists.txt
index e664a73ddd9..fea720f6095 100644
--- a/utils/api_checker/CMakeLists.txt
+++ b/utils/api_checker/CMakeLists.txt
@@ -16,7 +16,7 @@ set(SWIFTLIB_DIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/swift")
set(dest "${SWIFTLIB_DIR}/${framework}")
set(source "${CMAKE_CURRENT_SOURCE_DIR}/${framework}")
-if(CMAKE_SYSTEM_NAME STREQUAL Windows)
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(CMAKE_SYMLINK_COMMAND copy)
else()
set(CMAKE_SYMLINK_COMMAND create_symlink)
|