diff --git a/CMakeLists.txt b/CMakeLists.txt index 5db3f05a0..ae28e579d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,8 +24,15 @@ set(SWT_SOURCE_ROOT_DIR ${CMAKE_SOURCE_DIR}) project(SwiftTesting LANGUAGES CXX Swift) +if(CMAKE_VERSION VERSION_LESS 3.31) + if(CMAKE_SYSTEM_NAME STREQUAL "Generic" AND CMAKE_SYSTEM_PROCESSOR MATCHES "wasm32") + set(CMAKE_SYSTEM_NAME WASI) + set(WASI 1) + endif() +endif() + if(NOT APPLE) - if(NOT CMAKE_SYSTEM_NAME STREQUAL WASI) + if(NOT WASI) find_package(dispatch CONFIG) endif() find_package(Foundation CONFIG) diff --git a/cmake/modules/shared/CompilerSettings.cmake b/cmake/modules/shared/CompilerSettings.cmake index 78bd035bf..22c7b0a7d 100644 --- a/cmake/modules/shared/CompilerSettings.cmake +++ b/cmake/modules/shared/CompilerSettings.cmake @@ -42,7 +42,7 @@ if(NOT APPLE) add_compile_definitions("SWT_NO_SNAPSHOT_TYPES") add_compile_definitions("SWT_NO_FOUNDATION_FILE_COORDINATION") endif() -if(CMAKE_SYSTEM_NAME STREQUAL "WASI") +if(WASI) add_compile_definitions("SWT_NO_DYNAMIC_LINKING") add_compile_definitions("SWT_NO_PIPES") endif() @@ -60,7 +60,7 @@ if(SWT_TESTING_LIBRARY_VERSION) add_compile_definitions("$<$:SWT_TESTING_LIBRARY_VERSION=\"${SWT_TESTING_LIBRARY_VERSION}\">") endif() -if((NOT BUILD_SHARED_LIBS) AND (NOT CMAKE_SYSTEM_NAME STREQUAL WASI)) +if((NOT BUILD_SHARED_LIBS) AND NOT WASI) # When building a static library, Interop is not supported at this time add_compile_definitions("SWT_NO_INTEROP") endif()