]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
build(blake3): Assume aarch64 to be little-endian on CMake 3.18/3.19 (#1652) master
authorJ. Neuschäfer <j.ne@posteo.net>
Tue, 28 Oct 2025 18:48:23 +0000 (19:48 +0100)
committerGitHub <noreply@github.com>
Tue, 28 Oct 2025 18:48:23 +0000 (19:48 +0100)
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

index f32e57ab03b91239646d41f12d8e910edb7de497..62c7ff005a265c6c0a365d4fde28e5f539d18ff1 100644 (file)
@@ -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(
     [=[