mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-14 01:37:56 +08:00
Fix CMake tests on Windows (#2872)
* Changed CMake tests to use check_symbol_exists in network-related libraries on win32 instead of check_library_exists
This commit is contained in:
parent
cea60575f3
commit
020b0bede8
@ -180,6 +180,7 @@ include (CheckCSourceCompiles)
|
||||
include (CheckCSourceRuns)
|
||||
include (CMakeDependentOption)
|
||||
include (CheckCXXSymbolExists)
|
||||
include (CheckSymbolExists)
|
||||
|
||||
check_include_files (ifaddrs.h ZMQ_HAVE_IFADDRS)
|
||||
check_include_files (windows.h ZMQ_HAVE_WINDOWS)
|
||||
@ -193,13 +194,25 @@ if (ZMQ_HAVE_EVENTFD AND NOT CMAKE_CROSSCOMPILING)
|
||||
zmq_check_efd_cloexec ()
|
||||
endif ()
|
||||
|
||||
check_library_exists (ws2_32 fopen "" HAVE_WS2_32) # TODO: Why doesn't something logical like WSAStartup work?
|
||||
check_library_exists (ws2 fopen "" HAVE_WS2)
|
||||
check_library_exists (rpcrt4 fopen "" HAVE_RPCRT4) # UuidCreateSequential
|
||||
check_library_exists (iphlpapi fopen "" HAVE_IPHLAPI) # GetAdaptersAddresses
|
||||
|
||||
if (ZMQ_HAVE_WINDOWS)
|
||||
# Cannot use check_library_exists because the symbol is always declared as char(*)(void)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "ws2_32.lib")
|
||||
check_symbol_exists (WSAStartup "WinSock2.h" HAVE_WS2_32)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES "rpcrt4.lib")
|
||||
check_symbol_exists (UuidCreateSequential "Rpc.h" HAVE_RPCRT4)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES "iphlpapi.lib")
|
||||
check_symbol_exists (GetAdaptersAddresses "winsock2.h;Iphlpapi.h" HAVE_IPHLAPI)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES "")
|
||||
# TODO: This not the symbol we're looking for. What is the symbol?
|
||||
check_library_exists (ws2 fopen "" HAVE_WS2)
|
||||
else()
|
||||
check_cxx_symbol_exists (SO_PEERCRED sys/socket.h ZMQ_HAVE_SO_PEERCRED)
|
||||
check_cxx_symbol_exists (LOCAL_PEERCRED sys/socket.h ZMQ_HAVE_LOCAL_PEERCRED)
|
||||
endif()
|
||||
|
||||
find_library (RT_LIBRARY rt)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user