mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 06:49:38 -04:00
depends: set CMAKE_*_COMPILER_TARGET in toolchain
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=arm64-apple-darwin` on the compiler line, given we
are already setting `--target` for Darwin builds.
Would fix #31748.
Github-Pull: #31849
Rebased-From: 963355037f
This commit is contained in:
parent
477345207b
commit
c0756b758f
2 changed files with 5 additions and 0 deletions
|
@ -206,6 +206,7 @@ endif
|
||||||
$(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(final_build_id)
|
$(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(final_build_id)
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
sed -e 's|@depends_crosscompiling@|$(crosscompiling)|' \
|
sed -e 's|@depends_crosscompiling@|$(crosscompiling)|' \
|
||||||
|
-e 's|@host@|$(host)|' \
|
||||||
-e 's|@host_system_name@|$($(host_os)_cmake_system_name)|' \
|
-e 's|@host_system_name@|$($(host_os)_cmake_system_name)|' \
|
||||||
-e 's|@host_system_version@|$($(host_os)_cmake_system_version)|' \
|
-e 's|@host_system_version@|$($(host_os)_cmake_system_version)|' \
|
||||||
-e 's|@host_arch@|$(host_arch)|' \
|
-e 's|@host_arch@|$(host_arch)|' \
|
||||||
|
|
|
@ -13,6 +13,10 @@ if(@depends_crosscompiling@)
|
||||||
set(CMAKE_SYSTEM_NAME @host_system_name@)
|
set(CMAKE_SYSTEM_NAME @host_system_name@)
|
||||||
set(CMAKE_SYSTEM_VERSION @host_system_version@)
|
set(CMAKE_SYSTEM_VERSION @host_system_version@)
|
||||||
set(CMAKE_SYSTEM_PROCESSOR @host_arch@)
|
set(CMAKE_SYSTEM_PROCESSOR @host_arch@)
|
||||||
|
|
||||||
|
set(CMAKE_C_COMPILER_TARGET @host@)
|
||||||
|
set(CMAKE_CXX_COMPILER_TARGET @host@)
|
||||||
|
set(CMAKE_OBJCXX_COMPILER_TARGET @host@)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED CMAKE_C_FLAGS_INIT)
|
if(NOT DEFINED CMAKE_C_FLAGS_INIT)
|
||||||
|
|
Loading…
Add table
Reference in a new issue