diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b545a381e..1d9c684d94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,14 @@ if(BUILD_SHARED_LIBS) option(FOUNDATION_BUILD_TOOLS "build tools" ON) endif() +set(FOUNDATION_BUILD_NETWORKING_default ON) +if(CMAKE_SYSTEM_NAME STREQUAL WASI) + # Networking is not supported on WASI + set(FOUNDATION_BUILD_NETWORKING_default OFF) +endif() +option(FOUNDATION_BUILD_NETWORKING "build FoundationNetworking" + ${FOUNDATION_BUILD_NETWORKING_default}) + set(CMAKE_POSITION_INDEPENDENT_CODE YES) # Fetchable dependcies @@ -121,7 +129,9 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL WASI) endif() endif() find_package(LibXml2 REQUIRED) -find_package(CURL REQUIRED) +if(FOUNDATION_BUILD_NETWORKING) + find_package(CURL REQUIRED) +endif() # Common build flags (_CFURLSessionInterface, _CFXMLInterface, CoreFoundation) list(APPEND _Foundation_common_build_flags diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 29b9244065..f239bdf0ff 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -14,12 +14,12 @@ add_subdirectory(CoreFoundation) add_subdirectory(_CFXMLInterface) -if(NOT CMAKE_SYSTEM_NAME STREQUAL "WASI") +if(FOUNDATION_BUILD_NETWORKING) add_subdirectory(_CFURLSessionInterface) endif() add_subdirectory(Foundation) add_subdirectory(FoundationXML) -if(NOT CMAKE_SYSTEM_NAME STREQUAL "WASI") +if(FOUNDATION_BUILD_NETWORKING) add_subdirectory(FoundationNetworking) endif() if(FOUNDATION_BUILD_TOOLS)