diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fab83a0d1..10bc812561 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) option(BUILD_SHARED_LIBS "build shared libraries" ON) option(HAS_LIBDISPATCH_API "has libdispatch API" ON) -option(BUILD_NETWORKING "build FoundationNetworking module" ON) +option(FOUNDATION_ENABLE_FOUNDATION_NETWORKING "build FoundationNetworking module" ON) option(FOUNDATION_BUILD_TOOLS "build tools" ON) option(NS_CURL_ASSUME_FEATURES_MISSING "Assume that optional libcurl features are missing rather than test the library's version, for build debugging" NO) @@ -103,7 +103,7 @@ if(NOT BUILD_SHARED_LIBS) install(TARGETS CoreFoundation CFXMLInterface DESTINATION lib/swift_static/$) - if(BUILD_NETWORKING) + if(FOUNDATION_ENABLE_FOUNDATION_NETWORKING) set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS CFURLSessionInterface) install(TARGETS CFURLSessionInterface diff --git a/CoreFoundation/CMakeLists.txt b/CoreFoundation/CMakeLists.txt index 18c2e508f4..34192c65d6 100644 --- a/CoreFoundation/CMakeLists.txt +++ b/CoreFoundation/CMakeLists.txt @@ -28,11 +28,14 @@ endif() if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) find_package(LibXml2 REQUIRED) - find_package(CURL CONFIG) - if(CURL_FOUND) - set(CURL_VERSION_STRING ${CURL_VERSION}) - else() - find_package(CURL REQUIRED) + + if(FOUNDATION_ENABLE_FOUNDATION_NETWORKING) + find_package(CURL CONFIG) + if(CURL_FOUND) + set(CURL_VERSION_STRING ${CURL_VERSION}) + else() + find_package(CURL REQUIRED) + endif() endif() endif() @@ -438,7 +441,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows) PRIVATE CURL_STATICLIB) endif() -if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) +if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin AND FOUNDATION_ENABLE_FOUNDATION_NETWORKING) target_link_libraries(CFURLSessionInterface PRIVATE CURL::libcurl) endif() @@ -540,10 +543,16 @@ endif() install(TARGETS CoreFoundation - CFURLSessionInterface CFXMLInterface DESTINATION - "${CMAKE_INSTALL_FULL_LIBDIR}") + "${CMAKE_INSTALL_FULL_LIBDIR}/$") + +if(FOUNDATION_ENABLE_FOUNDATION_NETWORKING) + install(TARGETS + CFURLSessionInterface + DESTINATION + "${CMAKE_INSTALL_FULL_LIBDIR}/$") +endif() # Needed to avoid double slash "//" when CMAKE_INSTALL_PREFIX set to "/" and DESTDIR used to relocate whole installation. # Double slash raise CMake error "file called with network path DESTINATION //System/Library/Frameworks". diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 93c067d261..14ace7ad51 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -1,6 +1,8 @@ add_subdirectory(UUID) add_subdirectory(Foundation) -add_subdirectory(FoundationNetworking) +if(FOUNDATION_ENABLE_FOUNDATION_NETWORKING) + add_subdirectory(FoundationNetworking) +endif() add_subdirectory(FoundationXML) if(FOUNDATION_BUILD_TOOLS) add_subdirectory(Tools)