From 874675b00f9cdfe3ea5585441eccaddee2710a3e Mon Sep 17 00:00:00 2001 From: Meylis Annagurbanov Date: Sat, 29 Aug 2026 11:06:03 +0500 Subject: [PATCH] cmake: fix Darwin cpu_features check testing the wrong variable The Darwin branch of the cpu_features selection reads: elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME MATCHES "^(arm64|x86_64)") The second condition tests CMAKE_SYSTEM_NAME, which is "Darwin" inside this branch and so never matches ^(arm64|x86_64), where it plainly means CMAKE_SYSTEM_PROCESSOR. The NOT is therefore always true, and the branch the comment says we "should not reach" is the one always taken. The FreeBSD branch three lines above gets this right. The effect is currently masked -- macOS has no sys/auxv.h, so the HAVE_SYS_AUXV branch already defines SKIP_CPU_FEATURES first -- but the condition is still wrong and should behave as written if that check ever changes. --- src/Mayaqua/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mayaqua/CMakeLists.txt b/src/Mayaqua/CMakeLists.txt index 5245fa42..03c7b902 100644 --- a/src/Mayaqua/CMakeLists.txt +++ b/src/Mayaqua/CMakeLists.txt @@ -140,7 +140,7 @@ if(UNIX) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(amd64|i386)") message("cpu_features is not available on FreeBSD/${CMAKE_SYSTEM_PROCESSOR}") add_definitions(-DSKIP_CPU_FEATURES) - elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME MATCHES "^(arm64|x86_64)") + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|x86_64)") # macOS runs only on Intel or ARM architecrues, should not reach here add_definitions(-DSKIP_CPU_FEATURES) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")