Skip to content

Commit 57bf922

Browse files
authored
Merge pull request #66425 from apple/egorzhdan/cxxstdlib-darwin-dependency
[cxx-interop] Declare CxxStdlib dependency on Darwin when building both
2 parents 1e2553e + 60c91aa commit 57bf922

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

stdlib/public/Cxx/std/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# Swift compiler currently assumes that the Darwin overlay is a dependency of
2+
# CxxStdlib, and fails to build CxxStdlib if Darwin.swiftmodule in build dir
3+
# is built with a different (older) version of the compiler. To workaround this,
4+
# declare the Darwin overlay as a dependency of CxxStdlib.
5+
set(swift_cxxstdlib_darwin_dependencies)
6+
if(SWIFT_BUILD_STDLIB AND (SWIFT_BUILD_SDK_OVERLAY OR SWIFT_BUILD_TEST_SUPPORT_MODULES))
7+
set(swift_cxxstdlib_darwin_dependencies Darwin)
8+
endif()
9+
110
#
211
# C++ Standard Library Overlay.
312
#
@@ -6,6 +15,11 @@ add_swift_target_library(swiftCxxStdlib STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_O
615
String.swift
716

817
SWIFT_MODULE_DEPENDS Cxx
18+
SWIFT_MODULE_DEPENDS_IOS ${swift_cxxstdlib_darwin_dependencies}
19+
SWIFT_MODULE_DEPENDS_OSX ${swift_cxxstdlib_darwin_dependencies}
20+
SWIFT_MODULE_DEPENDS_TVOS ${swift_cxxstdlib_darwin_dependencies}
21+
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_cxxstdlib_darwin_dependencies}
22+
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_cxxstdlib_darwin_dependencies}
923

1024
SWIFT_COMPILE_FLAGS ${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS} ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
1125
-Xfrontend -enable-experimental-cxx-interop

0 commit comments

Comments
 (0)