From d4cda07a17b24cd5897cc50c1c4d5d4ccdb3b1e3 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <vital.had@gmail.com>
Date: Wed, 10 Jan 2024 12:49:54 +0800
Subject: [PATCH] UserOverride.cmake: fix native optflag for PowerPC

---
 cmake/UserOverride.cmake | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git cmake/UserOverride.cmake cmake/UserOverride.cmake
index 3139f24c8..5c5030118 100644
--- cmake/UserOverride.cmake
+++ cmake/UserOverride.cmake
@@ -9,7 +9,12 @@
 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
     # g++
     set(common "-Wall -Wextra")
-    set(CMAKE_CXX_FLAGS_RELEASE_INIT "${common} -O3 -march=native -funroll-loops -DNDEBUG")
+    if (CMAKE_SYSTEM_PROCESSOR MATCHES "ppc|powerpc")
+        set(native "-mtune=native")
+    # else ()
+    #     set(native "-march=native")
+    endif ()
+    set(CMAKE_CXX_FLAGS_RELEASE_INIT "${common} -O3 ${native} -funroll-loops -DNDEBUG")
     set(CMAKE_CXX_FLAGS_DEBUG_INIT   "${common} -g -ggdb")
 elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
     # icpc
