Skip to content

Commit 9cbaafb

Browse files
committed
build: avoid use of -external:I on Windows
Avoid the use of the new `-external:I` to indicate the system headers for building the standard library on Windows as this will impact the header search order and due to the compiler swapping and mixed build, this breaks the runtime build on Windows.
1 parent c06eccc commit 9cbaafb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

stdlib/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
# standard library from the Swift compiler build.
66
project(swift-stdlib LANGUAGES C CXX)
77

8+
# CMake passes `-external:I` to clang-cl which results in the search order being
9+
# altered, and this impacts the definitions of the intrinsics. When building
10+
# with a MSVC toolset 19.29.30036.3 or newer, this will prevent the runtime from
11+
# being built on Windows. Since we know that we only support `clang-cl` as the
12+
# compiler for the runtime due to the use of the Swift calling convention, we
13+
# simply override the CMake behaviour unconditionally.
14+
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-I")
15+
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-I")
16+
817
# Add path for custom CMake modules.
918
list(APPEND CMAKE_MODULE_PATH
1019
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

0 commit comments

Comments
 (0)