Skip to content

Commit

Permalink
Merge pull request #5064 from kateinoigakukun/pr-053b25017d60084b5d4f…
Browse files Browse the repository at this point in the history
…037ac2e5cfc6dd5bdb1f

Make curl an optional dependency when not building FoundationNetworking
  • Loading branch information
kateinoigakukun authored Aug 13, 2024
2 parents 2a27eca + 4127e85 commit e1d7356
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
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

0 comments on commit e1d7356

Please sign in to comment.