Description: Probe -mtune=generic instead of hardcoding it
Author: Andreas Tille <tille@debian.org>
Last-Update: 2026-08-14

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -211,10 +211,16 @@ else()
     include(CheckCXXCompilerFlag)
 
     set(ARCH_GENERIC_CXX_FLAGS
-        -mtune=generic
         -fno-stack-protector
     )
 
+    check_cxx_compiler_flag("-mtune=generic"
+                            HAVE_CXX_FLAG_MTUNE_GENERIC)
+
+    if(HAVE_CXX_FLAG_MTUNE_GENERIC)
+        list(APPEND ARCH_GENERIC_CXX_FLAGS -mtune=generic)
+    endif()
+
     check_cxx_compiler_flag("-fcf-protection=none"
                             HAVE_CXX_FLAG_FCF_PROTECTION_NONE)
 
