Skip to content

stdlib: reorder add_subdirectory to repair the Windows build #21330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ function(_add_swift_library_single target name)
# doing so will result in incorrect symbol resolution and linkage. We created
# import library targets when the library was added. Use that to adjust the
# link libraries.
if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "WINDOWS")
if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
foreach(library_list LINK_LIBRARIES INTERFACE_LINK_LIBRARIES PRIVATE_LINK_LIBRARIES)
set(import_libraries)
foreach(library ${SWIFTLIB_SINGLE_${library_list}})
Expand All @@ -1283,7 +1283,7 @@ function(_add_swift_library_single target name)
# libraries are only associated with shared libraries, so add an
# additional check for that as well.
set(import_library ${library})
if(TARGET ${library} AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
if(TARGET ${library})
get_target_property(type ${library} TYPE)
if(${type} STREQUAL "SHARED_LIBRARY")
set(import_library ${library}_IMPLIB)
Expand Down
6 changes: 5 additions & 1 deletion stdlib/private/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ if(SWIFT_BUILD_SDK_OVERLAY)
# SwiftPrivateThreadExtras makes use of Darwin/Glibc, which is part of the
# SDK overlay. It can't be built separately from the SDK overlay.
add_subdirectory(RuntimeUnittest)
add_subdirectory(StdlibUnittest)
add_subdirectory(StdlibUnicodeUnittest)
add_subdirectory(StdlibCollectionUnittest)
add_subdirectory(SwiftPrivateLibcExtras)
add_subdirectory(SwiftPrivateThreadExtras)

# NOTE(compnerd) this must come after SwiftPrivateLibcExtras and
# SwiftPrivateThreadExtras to ensure that the dependency targets are setup in
# the correct order for Windows.
add_subdirectory(StdlibUnittest)

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_subdirectory(StdlibUnittestFoundationExtras)
if (SWIFT_INCLUDE_TESTS)
Expand Down