cmake: set BUILD_ARCH with CMAKE_HOST_SYSTEM_PROCESSOR#7369
Open
nilason wants to merge 1 commit into
Open
Conversation
Remove custom function 'get_host_arch'.
HuidaeCho
reviewed
May 9, 2026
|
|
||
| include(get_host_arch) | ||
| get_host_arch(BUILD_ARCH) | ||
| set(BUILD_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR}) |
Member
There was a problem hiding this comment.
Overall, it looks good to me. Can we apply lowercase on Windows? Currently,
- Linux:
x86_64 - macOS:
x86_64,arm64 - Windows:
AMD64(should we unify it tox86_64?)
Contributor
Author
There was a problem hiding this comment.
Can we apply lowercase on Windows? ... (should we unify it to x86_64?)
I think it should be as straightforward as possible, that is, leave it as is.
Contributor
Author
There was a problem hiding this comment.
The question is: what do we want to show with build_platform? What relevant information should be output from a CMake build? And when/where would that be helpful? E.g., if a package is cross compiled, it may be of interest what was the host platform.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Set
BUILD_ARCHwithCMAKE_HOST_SYSTEM_PROCESSORand remove custom functionget_host_arch.I see no reason to not use CMake's variable for setting this, after all that is deciding what/how to build anyway. The custom function requires maintenance, macOS is currently not supported and defaults to
x86_64.The only effect this has is the
build_platformoutput ofg.version -g. Otherwise BUILD_ARCH is mainly a remnant of Autotools builds, where build output directory is named after Autotool's host variable (e.g.dist.aarch64-apple-darwin25.3.0; note: this is not the same as justuname -m) and this is passed to various Python build scripts, in CMake it doesn't play any role.