ClickHouse/cmake/arch.cmake
Robert Schulze 62aba875f5
Make arch detection more robust
- Properly handle the case that we are on an unsupported but unlisted
  arch, e.g. mips. Before, we would simply continue
  configuration/compilation with no architecture set.

- CMake variable "ARCH_ARM" could in theory be replaced by
  "ARCH_AARCH64". This would need refactoring in dependent CMakeLists,
  therefore not doing it now.
2022-04-25 13:08:17 +02:00

16 lines
593 B
CMake

if (CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
if (CMAKE_LIBRARY_ARCHITECTURE MATCHES "i386")
message (FATAL_ERROR "32bit platforms are not supported")
endif ()
set (ARCH_AMD64 1)
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)")
set (ARCH_AARCH64 1)
set (ARCH_ARM 1)
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(ppc64le.*|PPC64LE.*)")
set (ARCH_PPC64LE 1)
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64")
set (ARCH_RISCV64 1)
else ()
message (FATAL_ERROR "Platform ${CMAKE_SYSTEM_PROCESSOR} is not supported")
endif ()