From 2278b06b9c32cc4ce1b72e5fa6b7f5c0ace4d993 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=2E=20Neusch=C3=A4fer?= Date: Tue, 28 Oct 2025 19:48:23 +0100 Subject: [PATCH] build(blake3): Assume aarch64 to be little-endian on CMake 3.18/3.19 (#1652) The recently introduced detection of big-endian AArch64 uses the CMAKE_C_BYTE_ORDER variable, which was introduced in 3.20, but ccache currently only requires CMake 3.18. To avoid using an undefined variable, simply assume AArch64 to be little-endian on CMake versions that don't define the aforementioned variable. This is okay because big-endian AArch64 has few users and the subset of them that use CMake 3.18/3.19 is likely negligible. Reported-by: @awawa-dev Fixes: https://github.com/ccache/ccache/issues/1651 --- src/third_party/blake3/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/third_party/blake3/CMakeLists.txt b/src/third_party/blake3/CMakeLists.txt index f32e57ab..62c7ff00 100644 --- a/src/third_party/blake3/CMakeLists.txt +++ b/src/third_party/blake3/CMakeLists.txt @@ -116,7 +116,9 @@ _add_blake3_source_if_enabled(avx2 "/arch:AVX2" "-mavx2" "_mm256_abs_epi8(_mm256 _add_blake3_source_if_enabled(avx512 "/arch:AVX512" "-mavx512f -mavx512vl" "_mm256_abs_epi64(_mm256_set1_epi32(42))") # Neon is always available on AArch64, but blake3_neon.c only supports little-endian -if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_C_BYTE_ORDER STREQUAL "LITTLE_ENDIAN") +# Byte order detection requires CMake 3.20, we just assume little-endian on 3.18/3.19. +if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND + (NOT DEFINED CMAKE_C_BYTE_ORDER OR CMAKE_C_BYTE_ORDER STREQUAL "LITTLE_ENDIAN")) # https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics check_c_source_compiles( [=[ -- 2.47.3