Skip to content

Commit 2eb358b

Browse files
committed
Merge bitcoin/bitcoin#30508: depends: Fix CMake-generated libzmq.pc file
371910a depends: Fix CMake-generated `libzmq.pc` file (Hennadii Stepanov) Pull request description: This is a backport of: zeromq/libzmq#4706. Similar to bitcoin/bitcoin#30488. Addresses bitcoin/bitcoin#29723 (comment): > Looking at the mingw .pc generated by this PR: > > ``` > Libs: -L${libdir} -lzmq > Libs.private: > Requires.private: > ``` > > It looks like we'll need to take [zeromq/libzmq#4706](zeromq/libzmq#4706) as well for CMake. That can be done as a follow-up though, as it's not yet merged upstream. ACKs for top commit: fanquake: ACK 371910a Tree-SHA512: 6f9c2e32f83c0e629e32fd3e4c86712af00ffeaf0906bf85e5c2df889302707b9df102e8031249d1bae036eb4fc019c2a5124655682fbc5652d9337cb21c5f2c
2 parents 92c787f + 371910a commit 2eb358b

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)