Skip to content

Commit e563cb5

Browse files
committed
Merge bitcoin/bitcoin#31849: depends: set CMAKE_*_COMPILER_TARGET in toolchain
9633550 depends: set CMAKE_*_COMPILER_TARGET in toolchain (fanquake) Pull request description: According to the CMake docs, this is the correct way to setup a toolchain file for cross-compilation using Clang. See https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-using-clang Internally it looks like CMake will only take this variable into account if it detects the compiler to be Clang, so this shouldn't effect other builds, but in the case of our Apple cross builds, we'd end up with a duplicated `--target=$ARCH-apple-darwin` on the compiler line, given we are already setting `--target` for Darwin builds. Would fix #31748. ACKs for top commit: hebasto: ACK 9633550, tested on Ubuntu 24.10. Tree-SHA512: 1aa0c5d9cb069ce277e53b5551baf5249c449331b0a160edb9a8ceb56209f886a9e2051e2ba63e0874904f652ace0280b7483dd5d81bfff9e993eb18abb961ad
2 parents 603fcc0 + 9633550 commit e563cb5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

depends/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ endif
203203
$(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(final_build_id)
204204
@mkdir -p $(@D)
205205
sed -e 's|@depends_crosscompiling@|$(crosscompiling)|' \
206+
-e 's|@host@|$(host)|' \
206207
-e 's|@host_system_name@|$($(host_os)_cmake_system_name)|' \
207208
-e 's|@host_system_version@|$($(host_os)_cmake_system_version)|' \
208209
-e 's|@host_arch@|$(host_arch)|' \

depends/toolchain.cmake.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ if(@depends_crosscompiling@)
1313
set(CMAKE_SYSTEM_NAME @host_system_name@)
1414
set(CMAKE_SYSTEM_VERSION @host_system_version@)
1515
set(CMAKE_SYSTEM_PROCESSOR @host_arch@)
16+
17+
set(CMAKE_C_COMPILER_TARGET @host@)
18+
set(CMAKE_CXX_COMPILER_TARGET @host@)
19+
set(CMAKE_OBJCXX_COMPILER_TARGET @host@)
1620
endif()
1721

1822
if(NOT DEFINED CMAKE_C_FLAGS_INIT)

0 commit comments

Comments
 (0)