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 @@ -98,6 +98,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
9898 add_compile_definitions (MAC_OSX)
9999endif ()
100100
101+ if (CMAKE_CROSSCOMPILING AND DEPENDS_ALLOW_HOST_PACKAGES)
102+ list (APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_SYSTEM_PREFIX_PATH} " )
103+ endif ()
104+
101105include (AddThreadsIfNeeded)
102106add_threads_if_needed()
103107
@@ -127,6 +131,12 @@ message("=================")
127131message ("Executables:" )
128132message (" bitcoind ............................ ${BUILD_DAEMON} " )
129133message ("" )
134+ if (CMAKE_CROSSCOMPILING )
135+ set (cross_status "TRUE, for ${CMAKE_SYSTEM_NAME} , ${CMAKE_SYSTEM_PROCESSOR} " )
136+ else ()
137+ set (cross_status "FALSE" )
138+ endif ()
139+ message ("Cross compiling ....................... ${cross_status} " )
130140get_directory_property (definitions COMPILE_DEFINITIONS )
131141string (REPLACE ";" " " definitions "${definitions} " )
132142message ("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;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