summaryrefslogtreecommitdiff
blob: 1894fcc93b6c2840e9193eadc20813df600a2b14 (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
From 66e847d4e14be3a369b7e26a03a172b20e62c003 Mon Sep 17 00:00:00 2001
From: eksi <eksi@eksi.eksi>
Date: Wed, 4 Nov 2020 20:37:01 +0300
Subject: [PATCH] Add an option to disable -Werror. Fixes #1528

---
 cmake/ranges_flags.cmake   | 4 +++-
 cmake/ranges_options.cmake | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/cmake/ranges_flags.cmake b/cmake/ranges_flags.cmake
index 76d893043..9b09ddcb8 100644
--- a/cmake/ranges_flags.cmake
+++ b/cmake/ranges_flags.cmake
@@ -88,7 +88,9 @@ else()
   # Enable "normal" warnings and make them errors:
   ranges_append_flag(RANGES_HAS_WALL -Wall)
   ranges_append_flag(RANGES_HAS_WEXTRA -Wextra)
-  ranges_append_flag(RANGES_HAS_WERROR -Werror)
+  if (RANGES_ENABLE_WERROR)
+    ranges_append_flag(RANGES_HAS_WERROR -Werror)
+  endif()
 endif()
 
 if (RANGES_ENV_LINUX AND RANGES_CXX_COMPILER_CLANG)
diff --git a/cmake/ranges_options.cmake b/cmake/ranges_options.cmake
index 4ec39c7f0..8455af306 100644
--- a/cmake/ranges_options.cmake
+++ b/cmake/ranges_options.cmake
@@ -16,6 +16,9 @@ option(RANGES_MODULES "Enables use of Clang modules (experimental)." OFF)
 option(RANGES_NATIVE "Enables -march/-mtune=native." ON)
 option(RANGES_VERBOSE_BUILD "Enables debug output from CMake." OFF)
 option(RANGES_LLVM_POLLY "Enables LLVM Polly." OFF)
+option(RANGES_ENABLE_WERROR
+  "Enables -Werror. Only effective if compiler is not clang-cl or MSVC. ON by default"
+  ON)
 option(RANGES_PREFER_REAL_CONCEPTS
   "Use real concepts instead of emulation if the compiler supports it"
   ON)