Skip to content

Commit 371910a

Browse files
committed
depends: Fix CMake-generated libzmq.pc file
See zeromq/libzmq#4706.
1 parent 92c787f commit 371910a

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

depends/packages/zeromq.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ $(package)_patches += openbsd_kqueue_headers.patch
1212
$(package)_patches += cmake_minimum.patch
1313
$(package)_patches += cacheline_undefined.patch
1414
$(package)_patches += no_librt.patch
15+
$(package)_patches += fix_mingw_link.patch
1516

1617
define $(package)_set_vars
1718
$(package)_config_opts := -DCMAKE_BUILD_TYPE=None -DWITH_DOCS=OFF -DWITH_LIBSODIUM=OFF
@@ -30,7 +31,8 @@ define $(package)_preprocess_cmds
3031
patch -p1 < $($(package)_patch_dir)/fix_have_windows.patch && \
3132
patch -p1 < $($(package)_patch_dir)/openbsd_kqueue_headers.patch && \
3233
patch -p1 < $($(package)_patch_dir)/cmake_minimum.patch && \
33-
patch -p1 < $($(package)_patch_dir)/no_librt.patch
34+
patch -p1 < $($(package)_patch_dir)/no_librt.patch && \
35+
patch -p1 < $($(package)_patch_dir)/fix_mingw_link.patch
3436
endef
3537

3638
define $(package)_config_cmds
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Fix CMake-generated `libzmq.pc` file
2+
3+
This change mirrors the Autotools-based build system behavior for
4+
cross-compiling for Windows with static linking.
5+
6+
See https://github.com/zeromq/libzmq/pull/4706.
7+
8+
9+
diff --git a/CMakeLists.txt b/CMakeLists.txt
10+
index 03462271..0315e606 100644
11+
--- a/CMakeLists.txt
12+
+++ b/CMakeLists.txt
13+
@@ -546,12 +546,18 @@ if(ZMQ_HAVE_WINDOWS)
14+
# Cannot use check_library_exists because the symbol is always declared as char(*)(void)
15+
set(CMAKE_REQUIRED_LIBRARIES "ws2_32.lib")
16+
check_cxx_symbol_exists(WSAStartup "winsock2.h" HAVE_WS2_32)
17+
+ if(HAVE_WS2_32)
18+
+ set(pkg_config_libs_private "${pkg_config_libs_private} -lws2_32")
19+
+ endif()
20+
21+
set(CMAKE_REQUIRED_LIBRARIES "rpcrt4.lib")
22+
check_cxx_symbol_exists(UuidCreateSequential "rpc.h" HAVE_RPCRT4)
23+
24+
set(CMAKE_REQUIRED_LIBRARIES "iphlpapi.lib")
25+
check_cxx_symbol_exists(GetAdaptersAddresses "winsock2.h;iphlpapi.h" HAVE_IPHLAPI)
26+
+ if(HAVE_IPHLAPI)
27+
+ set(pkg_config_libs_private "${pkg_config_libs_private} -liphlpapi")
28+
+ endif()
29+
check_cxx_symbol_exists(if_nametoindex "iphlpapi.h" HAVE_IF_NAMETOINDEX)
30+
31+
set(CMAKE_REQUIRED_LIBRARIES "")

0 commit comments

Comments
 (0)