Skip to content

Commit d4ea278

Browse files
committed
build: pass the Windows headers properly
The Windows headers are the system (sysroot) headers. They are not consumed by swift but the clang importer. Furthermore, they should be treated as system headers. Correct the flags used for the invocation. This fixes the build of the SDK overlay for Windows.
1 parent 1982d02 commit d4ea278

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,16 +818,16 @@ function(_add_swift_library_single target name)
818818
endif()
819819

820820
if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "WINDOWS")
821-
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE} SWIFTLIB_INCLUDE)
822821
if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
823822
swift_windows_generate_sdk_vfs_overlay(SWIFTLIB_SINGLE_VFS_OVERLAY_FLAGS)
824823
foreach(flag ${SWIFTLIB_SINGLE_VFS_OVERLAY_FLAGS})
825824
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xcc;${flag})
826825
list(APPEND SWIFTLIB_SINGLE_C_COMPILE_FLAGS ${flag})
827826
endforeach()
828827
endif()
828+
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE} SWIFTLIB_INCLUDE)
829829
foreach(directory ${SWIFTLIB_INCLUDE})
830-
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xfrontend;-I${directory})
830+
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xcc;-isystem;-Xcc;${directory})
831831
endforeach()
832832
if("${SWIFTLIB_SINGLE_ARCHITECTURE}" MATCHES arm)
833833
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xcc;-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)

0 commit comments

Comments
 (0)