cm introduce CURL_LIBS_SOCKET use in tests/server'

This commit is contained in:
Viktor Szakats 2025-06-21 20:19:01 +02:00
parent df0d887ae5
commit 8f7321c57a
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 7 additions and 0 deletions

View file

@ -362,6 +362,7 @@ option(CURL_USE_PKGCONFIG "Enable pkg-config to detect dependencies" ${_curl_use
# Initialize variables collecting dependency libs, paths, pkg-config names.
set(CURL_LIBS "")
set(CURL_LIBS_SOCKET "")
set(CURL_LIBDIRS "")
set(LIBCURL_PC_REQUIRES_PRIVATE "")
@ -543,8 +544,10 @@ endif()
# If we are on Haiku, make sure that the network library is brought in.
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
list(APPEND CURL_LIBS "network")
list(APPEND CURL_LIBS_SOCKET "network")
elseif(AMIGA)
list(APPEND CURL_LIBS "net" "m" "atomic")
list(APPEND CURL_LIBS_SOCKET "net" "m" "atomic")
list(APPEND CMAKE_REQUIRED_LIBRARIES "net" "m" "atomic")
endif()
@ -613,6 +616,7 @@ elseif(DOS)
set(USE_WATT32 ON)
# FIXME upstream: must specify the full path to avoid CMake converting "watt" to "watt.lib"
list(APPEND CURL_LIBS "${WATT_ROOT}/lib/libwatt.a")
list(APPEND CURL_LIBS_SOCKET "${WATT_ROOT}/lib/libwatt.a")
include_directories(SYSTEM "${WATT_ROOT}/inc")
list(APPEND CMAKE_REQUIRED_INCLUDES "${WATT_ROOT}/inc")
else()
@ -633,6 +637,7 @@ elseif(NOT APPLE)
check_library_exists("socket" "connect" "" HAVE_LIBSOCKET)
if(HAVE_LIBSOCKET)
set(CURL_LIBS "socket" ${CURL_LIBS})
set(CURL_LIBS_SOCKET "socket" ${CURL_LIBS})
endif()
endif()
@ -1955,6 +1960,7 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "HAVE_CONFIG_H")
if(WIN32)
list(APPEND CURL_LIBS "${_win32_winsock}")
list(APPEND CURL_LIBS_SOCKET "${_win32_winsock}")
if(NOT WINCE AND NOT WINDOWS_STORE)
list(APPEND CURL_LIBS "iphlpapi")
endif()

View file

@ -36,6 +36,7 @@ add_custom_command(OUTPUT "${BUNDLE}.c"
add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE}.c")
add_dependencies(testdeps ${BUNDLE})
target_link_libraries(${BUNDLE} ${CURL_LIBS_SOCKET})
target_include_directories(${BUNDLE} PRIVATE
"${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
"${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h", curlx