Skip to content

Make curl an optional dependency when not building FoundationNetworking #5064

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
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
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down