File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
8888 add_compile_definitions (MAC_OSX)
8989endif ()
9090
91+ if (CMAKE_CROSSCOMPILING AND DEPENDS_ALLOW_HOST_PACKAGES)
92+ list (APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_SYSTEM_PREFIX_PATH} " )
93+ endif ()
94+
9195include (AddThreadsIfNeeded)
9296add_threads_if_needed()
9397
@@ -130,6 +134,12 @@ message("=================")
130134message ("Executables:" )
131135message (" bitcoind ............................ ${BUILD_DAEMON} " )
132136message ("" )
137+ if (CMAKE_CROSSCOMPILING )
138+ set (cross_status "TRUE, for ${CMAKE_SYSTEM_NAME} , ${CMAKE_SYSTEM_PROCESSOR} " )
139+ else ()
140+ set (cross_status "FALSE" )
141+ endif ()
142+ message ("Cross compiling ....................... ${cross_status} " )
133143get_directory_property (definitions COMPILE_DEFINITIONS )
134144string (REPLACE ";" " " definitions "${definitions} " )
135145message ("Preprocessor defined macros ........... ${definitions} " )
Original file line number Diff line number Diff line change @@ -37,15 +37,15 @@ function(add_libevent_if_needed)
3737 return ()
3838 endif ()
3939
40- find_package (PkgConfig )
41- pkg_check_modules (libevent REQUIRED libevent>=${libevent_minimum_version} IMPORTED_TARGET GLOBAL )
40+ include (CrossPkgConfig )
41+ cross_pkg_check_modules (libevent REQUIRED libevent>=${libevent_minimum_version} IMPORTED_TARGET GLOBAL )
4242 check_evhttp_connection_get_peer(PkgConfig::libevent)
4343 target_link_libraries (PkgConfig::libevent INTERFACE
4444 $<$<BOOL :${MINGW} >:iphlpapi;ssp;ws2_32>
4545 )
4646 add_library (libevent::libevent ALIAS PkgConfig::libevent)
4747
4848 if (NOT WIN32 )
49- pkg_check_modules (libevent_pthreads REQUIRED libevent_pthreads>=${libevent_minimum_version} IMPORTED_TARGET)
49+ cross_pkg_check_modules (libevent_pthreads REQUIRED libevent_pthreads>=${libevent_minimum_version} IMPORTED_TARGET)
5050 endif ()
5151endfunction ()
Original file line number Diff line number Diff line change 1+ # Copyright (c) 2023 The Bitcoin Core developers
2+ # Distributed under the MIT software license, see the accompanying
3+ # file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+ find_package (PkgConfig REQUIRED)
6+
7+ macro (cross_pkg_check_modules)
8+ if (CMAKE_CROSSCOMPILING )
9+ set (pkg_config_path_saved "$ENV{PKG_CONFIG_PATH} " )
10+ set (pkg_config_libdir_saved "$ENV{PKG_CONFIG_LIBDIR} " )
11+ set (ENV{PKG_CONFIG_PATH} ${PKG_CONFIG_PATH} )
12+ set (ENV{PKG_CONFIG_LIBDIR} ${PKG_CONFIG_LIBDIR} )
13+ pkg_check_modules(${ARGV} )
14+ set (ENV{PKG_CONFIG_PATH} ${pkg_config_path_saved} )
15+ set (ENV{PKG_CONFIG_LIBDIR} ${pkg_config_libdir_saved} )
16+ else ()
17+ pkg_check_modules(${ARGV} )
18+ endif ()
19+ endmacro ()
You can’t perform that action at this time.
0 commit comments