In CMake, what are the different possible values of CMAKE_SYSTEM_PROCESSOR
? At least, the values for common processor families by AMD, Intel, Apple, Qualcomm and such?
I couldn't find this information in the CMake documentation.
In CMake, what are the different possible values of CMAKE_SYSTEM_PROCESSOR
? At least, the values for common processor families by AMD, Intel, Apple, Qualcomm and such?
I couldn't find this information in the CMake documentation.
According to the documentation, "when not cross-compiling, this variable has the same value as the CMAKE_HOST_SYSTEM_PROCESSOR
variable". In the former scenario, the variable is set by the toolchain file, which I assume is what you're interested in doing.
In the latter case, the documentation says that CMAKE_HOST_SYSTEM_PROCESSOR
is determined by inspecting the environment in the following way:
PROCESSOR_ARCHITECTURE
environment variable is used.
AMD64
, IA64
, ARM64
, EM64T
, X86
. Source: this SuperUser answer.uname -m
is used by default. However, since this might vary based on whether you're using x86 or ARM CMake, version 3.19.2+ will use the value of CMAKE_APPLE_SILICON_PROCESSOR
(either CMake or environment variable) instead, if it is set. It also normalizes Power Macintosh
to powerpc
.
x86_64
, arm64
, and powerpc
.arch -s
command.
uname -m
uname
command and tries uname -p
first. If it returns a non-zero exit status, it resorts to uname -m
But what really matters is how CMake will use the value of CMAKE_SYSTEM_PROCESSOR
. Here are the functions I'm aware of:
CPACK_SYSTEM_NAME
is ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}
.Modules/CMake<LANG>Information.cmake
all optionally include platform modules suffixed with -${CMAKE_SYSTEM_PROCESSOR}.cmake
--mcpu
(compile) and --cpu
(link)