mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 00:19:06 +08:00
[vcpkg_configure_make] Set the --host parameter in case of Linux crosscompile (#22331)
Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com> Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com>
This commit is contained in:
parent
122bdbcec6
commit
d15470bb64
@ -465,6 +465,21 @@ function(vcpkg_configure_make)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Linux - cross-compiling support
|
||||
if(VCPKG_TARGET_IS_LINUX)
|
||||
if (requires_autoconfig AND NOT arg_BUILD_TRIPLET OR arg_DETERMINE_BUILD_TRIPLET)
|
||||
# The regex below takes the prefix from the resulting CMAKE_C_COMPILER variable eg. arm-linux-gnueabihf-gcc
|
||||
# set in the common toolchains/linux.cmake
|
||||
# This is used via --host as a prefix for all other bin tools as well.
|
||||
# Setting the compiler directly via CC=arm-linux-gnueabihf-gcc does not work acording to:
|
||||
# https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Specifying-Target-Triplets.html
|
||||
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "([^\/]*)-gcc$" AND CMAKE_MATCH_1)
|
||||
set(arg_BUILD_TRIPLET "--host=${CMAKE_MATCH_1}") # (Host activates crosscompilation; The name given here is just the prefix of the host tools for the target)
|
||||
endif()
|
||||
debug_message("Using make triplet: ${arg_BUILD_TRIPLET}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Cleanup previous build dirs
|
||||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
||||
|
Loading…
Reference in New Issue
Block a user