Skip to content

Commit 5f408ba

Browse files
hebastobluca
authored andcommitted
Fix CMake-generated libzmq.pc file
This change mirrors the Autotools-based build system behavior for cross-compiling for Windows with static linking.
1 parent 4c6cff6 commit 5f408ba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -567,12 +567,18 @@ if(ZMQ_HAVE_WINDOWS)
567567
# Cannot use check_library_exists because the symbol is always declared as char(*)(void)
568568
set(CMAKE_REQUIRED_LIBRARIES "ws2_32.lib")
569569
check_cxx_symbol_exists(WSAStartup "winsock2.h" HAVE_WS2_32)
570+
if(HAVE_WS2_32)
571+
set(pkg_config_libs_private "${pkg_config_libs_private} -lws2_32")
572+
endif()
570573

571574
set(CMAKE_REQUIRED_LIBRARIES "rpcrt4.lib")
572575
check_cxx_symbol_exists(UuidCreateSequential "rpc.h" HAVE_RPCRT4)
573576

574577
set(CMAKE_REQUIRED_LIBRARIES "iphlpapi.lib")
575578
check_cxx_symbol_exists(GetAdaptersAddresses "winsock2.h;iphlpapi.h" HAVE_IPHLAPI)
579+
if(HAVE_IPHLAPI)
580+
set(pkg_config_libs_private "${pkg_config_libs_private} -liphlpapi")
581+
endif()
576582
check_cxx_symbol_exists(if_nametoindex "iphlpapi.h" HAVE_IF_NAMETOINDEX)
577583

578584
set(CMAKE_REQUIRED_LIBRARIES "")

0 commit comments

Comments
 (0)