Skip to content

Commit e1d7356

Browse files
Merge pull request #5064 from kateinoigakukun/pr-053b25017d60084b5d4f037ac2e5cfc6dd5bdb1f
Make curl an optional dependency when not building FoundationNetworking
2 parents 2a27eca + 4127e85 commit e1d7356

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

CMakeLists.txt

+11-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ if(BUILD_SHARED_LIBS)
6363
option(FOUNDATION_BUILD_TOOLS "build tools" ON)
6464
endif()
6565

66+
set(FOUNDATION_BUILD_NETWORKING_default ON)
67+
if(CMAKE_SYSTEM_NAME STREQUAL WASI)
68+
# Networking is not supported on WASI
69+
set(FOUNDATION_BUILD_NETWORKING_default OFF)
70+
endif()
71+
option(FOUNDATION_BUILD_NETWORKING "build FoundationNetworking"
72+
${FOUNDATION_BUILD_NETWORKING_default})
73+
6674
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
6775

6876
# Fetchable dependcies
@@ -121,7 +129,9 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL WASI)
121129
endif()
122130
endif()
123131
find_package(LibXml2 REQUIRED)
124-
find_package(CURL REQUIRED)
132+
if(FOUNDATION_BUILD_NETWORKING)
133+
find_package(CURL REQUIRED)
134+
endif()
125135

126136
# Common build flags (_CFURLSessionInterface, _CFXMLInterface, CoreFoundation)
127137
list(APPEND _Foundation_common_build_flags

Sources/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
add_subdirectory(CoreFoundation)
1616
add_subdirectory(_CFXMLInterface)
17-
if(NOT CMAKE_SYSTEM_NAME STREQUAL "WASI")
17+
if(FOUNDATION_BUILD_NETWORKING)
1818
add_subdirectory(_CFURLSessionInterface)
1919
endif()
2020
add_subdirectory(Foundation)
2121
add_subdirectory(FoundationXML)
22-
if(NOT CMAKE_SYSTEM_NAME STREQUAL "WASI")
22+
if(FOUNDATION_BUILD_NETWORKING)
2323
add_subdirectory(FoundationNetworking)
2424
endif()
2525
if(FOUNDATION_BUILD_TOOLS)

0 commit comments

Comments
 (0)