summarylogtreecommitdiffstats
path: root/0001-makepkg-Fix-compiler-verification-and-compiler-flags.patch
blob: d2faa77953fa6f50c3c35d30ff158e4d3c458656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 47681afb2edfa1abf79ed0d6d404f872be706e3d Mon Sep 17 00:00:00 2001
From: KokaKiwi <kokakiwi+git@kokakiwi.net>
Date: Mon, 8 Aug 2022 00:34:05 +0200
Subject: [PATCH 1/2] makepkg: Fix compiler verification and compiler flags

---
 cmake/build_helpers.cmake | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake
index b7f8ff51..f38bf4b6 100644
--- a/cmake/build_helpers.cmake
+++ b/cmake/build_helpers.cmake
@@ -322,15 +322,14 @@ function(detectBadClone)
     endforeach ()
 endfunction()
 
-set(IMHEX_REQUIRED_COMPILER "GNU")
-set(IMHEX_MIN_COMPILER_VERSION "12.0.0")
+set(IMHEX_MIN_GCC_VERSION "12.0.0")
 function(verifyCompiler)
     if (IMHEX_IGNORE_BAD_COMPILER)
         return()
     endif()
 
-    if (NOT CMAKE_CXX_COMPILER_ID STREQUAL ${IMHEX_REQUIRED_COMPILER} OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${IMHEX_MIN_COMPILER_VERSION})
-        message(FATAL_ERROR "ImHex requires GCC ${IMHEX_MIN_COMPILER_VERSION} or newer. Please use the latest GCC version.")
+    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${IMHEX_MIN_GCC_VERSION})
+        message(FATAL_ERROR "ImHex requires GCC ${IMHEX_MIN_GCC_VERSION} or newer. Please use the latest GCC version.")
     endif()
 endfunction()
 
@@ -369,10 +368,14 @@ function(downloadImHexPatternsFiles dest)
 endfunction()
 
 macro(setupCompilerWarnings target)
-    set(IMHEX_COMMON_FLAGS "-Wall -Wextra -Werror")
-    set(IMHEX_C_FLAGS "${IMHEX_COMMON_FLAGS} -Wno-restrict -Wno-stringop-overread")
+    set(IMHEX_COMMON_FLAGS "")
+    set(IMHEX_C_FLAGS "${IMHEX_COMMON_FLAGS}")
+
+    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+        set(IMHEX_C_FLAGS "${IMHEX_C_FLAGS} -Wno-restrict -Wno-stringop-overread")
+    endif()
 
     set(CMAKE_C_FLAGS    "${CMAKE_C_FLAGS}    ${IMHEX_C_FLAGS}")
     set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS}  ${IMHEX_C_FLAGS}")
     set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} ${IMHEX_COMMON_FLAGS}")
-endmacro()
\ No newline at end of file
+endmacro()
-- 
2.37.1