Skip to content

Commit f4c2205

Browse files
[WASM] Use prebuilt llvm-ar only on Linux
1 parent b191b7c commit f4c2205

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ ENABLE_LANGUAGE(C)
3131
include(SwiftUtils)
3232
include(CheckSymbolExists)
3333

34-
# WebAssembly: hack: use llvm-ar for creating static libraries; Ubuntu's GNU ar doesn't work with wasm-ld
35-
set(CMAKE_AR "${SWIFT_WASM_WASI_SDK_PATH}/bin/llvm-ar")
36-
3734
#
3835
# User-configurable options that control the inclusion and default build
3936
# behavior for components which may not strictly be necessary (tools, examples,
@@ -853,6 +850,11 @@ if(swift_build_wasm AND NOT "${SWIFT_HOST_VARIANT_SDK}" STREQUAL "WASM")
853850
# message(FATAL_ERROR "A Darwin or Linux host is required to build the Swift runtime for Android")
854851
#endif()
855852

853+
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
854+
# WebAssembly: hack: use llvm-ar for creating static libraries; Ubuntu's GNU ar doesn't work with wasm-ld
855+
set(CMAKE_AR "${SWIFT_WASM_WASI_SDK_PATH}/bin/llvm-ar")
856+
endif()
857+
856858
if("${SWIFT_SDK_WASM_ARCHITECTURES}" STREQUAL "")
857859
set(SWIFT_SDK_WASM_ARCHITECTURES wasm32)
858860
endif()

0 commit comments

Comments
 (0)