Files
swift-mirror/unittests/Basic/CMakeLists.txt
Stéphan Kochen 7b460ce495 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.
2023-07-17 21:50:50 +02:00

56 lines
1.2 KiB
CMake

set(generated_tests UnicodeGraphemeBreakTest.cpp.gyb)
handle_gyb_sources(
gyb_dependency_targets
generated_tests
ARCH ${SWIFT_HOST_VARIANT_ARCH})
add_swift_unittest(SwiftBasicTests
BlotMapVectorTest.cpp
BlocklistTest.cpp
CacheTest.cpp
ClangImporterOptionsTest.cpp
ClusteredBitVectorTest.cpp
DemangleTest.cpp
DiverseStackTest.cpp
EditorPlaceholderTest.cpp
EncodedSequenceTest.cpp
ExponentialGrowthAppendingBinaryByteStreamTests.cpp
FileSystemTest.cpp
FixedBitSetTest.cpp
FrozenMultiMapTest.cpp
ImmutablePointerSetTest.cpp
JSONSerialization.cpp
OptionSetTest.cpp
OwnedStringTest.cpp
MultiMapCacheTest.cpp
PointerIntEnumTest.cpp
PrefixMapTest.cpp
RangeTest.cpp
SourceManagerTest.cpp
StableHasher.cpp
STLExtrasTest.cpp
StringExtrasTest.cpp
SuccessorMapTest.cpp
TaggedUnionTest.cpp
ThreadSafeRefCntPointerTest.cpp
TransformRangeTest.cpp
TypeLookupError.cpp
UnicodeTest.cpp
${generated_tests}
)
add_dependencies(SwiftBasicTests "${gyb_dependency_targets}")
target_link_libraries(SwiftBasicTests
PRIVATE
swiftBasic
swiftThreading
clangBasic
LLVMTestingSupport
)
if(SWIFT_HOST_VARIANT STREQUAL "windows")
target_link_libraries(SwiftBasicTests PRIVATE Synchronization)
endif()