Skip to content

Commit 2b37e96

Browse files
committed
unittests: Build runtime unit tests with -DGTEST_NO_LLVM_SUPPORT
...to work around error building `unittests/runtime` on Linux. `stdlib/include/llvm/Support` headers, a subset of `llvm-project/llvm/include/llvm/Support`, are not compatible with the latter. Since we favor stdlib headers here, this makes sure Support headers will not be transitively included through gtest, and helps to avoid mixed includes, where a Support header existing only in LLVM is picked from LLVM, whereas a Support header existing in both of the aforementioned directories is picked from our stdlib.
1 parent 57f7d80 commit 2b37e96

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

unittests/runtime/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
140140
target_include_directories(SwiftRuntimeTests BEFORE PRIVATE
141141
${SWIFT_SOURCE_DIR}/stdlib/public)
142142

143+
# `stdlib/include/llvm/Support` headers, a subset of
144+
# `llvm-project/llvm/include/llvm/Support`, are not compatible with the
145+
# latter.
146+
#
147+
# Since we favor stdlib headers here, this makes sure Support headers will not
148+
# be transitively included through gtest, and helps to avoid mixed includes,
149+
# where a Support header existing only in LLVM is picked from LLVM, whereas
150+
# a Support header existing in both of the aforementioned directories is
151+
# picked from our stdlib.
152+
target_compile_definitions(SwiftRuntimeTests PRIVATE
153+
GTEST_NO_LLVM_SUPPORT)
154+
143155
# FIXME: cross-compile for all variants.
144156
target_link_libraries(SwiftRuntimeTests
145157
PRIVATE

0 commit comments

Comments
 (0)