Skip to content

CMake: Fix accidental variable expansion of WASI #5084

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
Sep 20, 2024
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
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if(BUILD_SHARED_LIBS)
endif()

set(FOUNDATION_BUILD_NETWORKING_default ON)
if(CMAKE_SYSTEM_NAME STREQUAL WASI)
if(CMAKE_SYSTEM_NAME STREQUAL "WASI")
# Networking is not supported on WASI
set(FOUNDATION_BUILD_NETWORKING_default OFF)
endif()
Expand Down Expand Up @@ -133,7 +133,7 @@ endif()
# System dependencies

# We know libdispatch is always unavailable on WASI
if(NOT CMAKE_SYSTEM_NAME STREQUAL WASI)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "WASI")
find_package(LibRT)
find_package(dispatch CONFIG)
if(NOT dispatch_FOUND)
Expand Down Expand Up @@ -170,7 +170,7 @@ list(APPEND _Foundation_common_build_flags
"-Wno-switch"
"-fblocks")

if(NOT CMAKE_SYSTEM_NAME STREQUAL WASI)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "WASI")
list(APPEND _Foundation_common_build_flags
"-DDEPLOYMENT_ENABLE_LIBDISPATCH"
"-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS")
Expand Down Expand Up @@ -206,7 +206,7 @@ list(APPEND _Foundation_swift_build_flags
"-Xfrontend"
"-require-explicit-sendable")

if(CMAKE_SYSTEM_NAME STREQUAL WASI)
if(CMAKE_SYSTEM_NAME STREQUAL "WASI")
# Enable wasi-libc emulation features
set(WASI_EMULATION_DEFS _WASI_EMULATED_MMAN _WASI_EMULATED_SIGNAL _WASI_EMULATED_PROCESS_CLOCKS)
foreach(def ${WASI_EMULATION_DEFS})
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ target_link_libraries(CoreFoundation
_FoundationICU
dispatch)

if(CMAKE_SYSTEM_NAME STREQUAL WASI)
if(CMAKE_SYSTEM_NAME STREQUAL "WASI")
# On WASI, we use vendored BlocksRuntime instead of the one from libdispatch
add_subdirectory(BlockRuntime)
# Add BlocksRuntime object library to CoreFoundation static archive
Expand Down
2 changes: 1 addition & 1 deletion Sources/_CFXMLInterface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ target_link_libraries(_CFXMLInterface PRIVATE
dispatch
LibXml2::LibXml2)

if(CMAKE_SYSTEM_NAME STREQUAL WASI)
if(CMAKE_SYSTEM_NAME STREQUAL "WASI")
target_link_libraries(_CFXMLInterface PRIVATE BlocksRuntime)
endif()

Expand Down