Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg scripts] use CMAKE_C_COMPILER_TARGET to detect cross-compilation #41651

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/cmake/vcpkg_configure_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,11 @@ function(vcpkg_configure_make)
# 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)
# (--host activates crosscompilation; The name given here is just the prefix of the host tools for the target)
if (VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET)
set(arg_BUILD_TRIPLET "--host=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET}")
elseif(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "([^\/]*)-gcc$" AND CMAKE_MATCH_1)
set(arg_BUILD_TRIPLET "--host=${CMAKE_MATCH_1}")
endif()
debug_message("Using make triplet: ${arg_BUILD_TRIPLET}")
endif()
Expand Down