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

Conversation

russelltg
Copy link
Contributor

@russelltg russelltg commented Oct 19, 2024

Currently, the only way to cross-compile using vcpkg_configure_make is
to use a gcc cross toolchain with the target as the prefix.

This is not how you cross compile with clang--with clang you set
CMAKE_<LANG>_COMPILER_TARGET. This detects this from the toolchain file
and passes it along.

This is tested & works with an internal toolchain file. libbacktrace failed to cross-compile without this change.

Currently, the only way to cross-compile using vcpkg_configure_make is
to use a gcc cross toolchain with the target as the prefix.

This is not how you cross compile with clang--with clang you set
CMAKE_<LANG>_COMPILER_TARGET. This detects this from the toolchain file
and passes it along
@russelltg russelltg force-pushed the configure_make_xcompile_clang branch 2 times, most recently from cb6d1ed to 316ac13 Compare October 19, 2024 00:29
@dg0yt
Copy link
Contributor

dg0yt commented Oct 19, 2024

Don't expect changes to vcpkg_configure_make: Port vcpkg-make is coming in #39050. And there is a triplet variable which you can already use.

@russelltg
Copy link
Contributor Author

Not sure what you mean by "there is a triplet variable which I can already use" which variable are you referring to, and why would it be better than CMAKE_C_COMPILER_TARGET?

Should I wait for that PR to land and update ports?

@dg0yt
Copy link
Contributor

dg0yt commented Oct 20, 2024

The vcpkg owners don't want make changes to the unversioned script. Too much risk. So we have to wait for that PR.

The variable is VCPKG_MAKE_BUILD_TRIPLET,
https://learn.microsoft.com/en-us/vcpkg/maintainers/functions/vcpkg_configure_make#build_triplet

I don't say it is better asking the compiler, but at least you can control which options are passed to configure.

@JonLiu1993 JonLiu1993 added the category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly label Oct 21, 2024
@JonLiu1993 JonLiu1993 changed the title configure_make: use CMAKE_C_COMPILER_TARGET to detect cross-compilation [vcpkg scripts] use CMAKE_C_COMPILER_TARGET to detect cross-compilation Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants