aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2026-08-09 02:56:28 +0200
committercrueter <crueter@eden-emu.dev>2026-08-09 02:56:28 +0200
commitc4ab2f6b9eaa65a266ad7b9339eb1fc57983476b (patch)
tree09826b1326085753c7f8b9c46c3877a13613b8dc /src
parentdd12266c26f6e1bf0091041d22fbbd68886d0a40 (diff)
[cmake] Add ENABLE_WERROR option (#4080)
Should warnings be errors? that's a philosophical debate which I can only answer with "no, but if you think otherwise here is an option for you" Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4080 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt28
-rw-r--r--src/audio_core/CMakeLists.txt2
-rw-r--r--src/common/CMakeLists.txt2
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/hid_core/CMakeLists.txt2
-rw-r--r--src/input_common/CMakeLists.txt2
-rw-r--r--src/shader_recompiler/CMakeLists.txt2
-rw-r--r--src/video_core/CMakeLists.txt2
8 files changed, 27 insertions, 15 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a6d526c5eb..882aff70f0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -155,12 +155,24 @@ else()
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
endif()
+ if (ENABLE_WERROR)
+ add_compile_options(
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=all>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=extra>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=missing-declarations>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=shadow>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=unused>)
+ else()
+ add_compile_options(
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wall>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wextra>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wmissing-declarations>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wshadow>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wunused>
+ # Some compilers could particularly misbehave :)
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-error-all>)
+ endif()
add_compile_options(
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=all>
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=extra>
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=missing-declarations>
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=shadow>
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=unused>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-attributes>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-invalid-offsetof>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-unused-parameter>
@@ -169,9 +181,9 @@ else()
if (CXX_CLANG OR CXX_ICC OR CXX_APPLE) # Clang, AppleClang, or Intel C++
if (NOT MSVC)
add_compile_options(
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=shadow-uncaptured-local>
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=implicit-fallthrough>
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=type-limits>)
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wshadow-uncaptured-local>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wimplicit-fallthrough>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wtype-limits>)
endif()
add_compile_options(
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-braced-scalar-init>
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index 4d0b130afc..b186edaab4 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -222,7 +222,7 @@ if (MSVC)
)
else()
target_compile_options(audio_core PRIVATE
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=conversion>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wconversion>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-sign-conversion>)
endif()
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 923d001442..10e8cd0cc7 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -220,7 +220,7 @@ endif()
if(CXX_CLANG)
target_compile_options(common PRIVATE
$<$<COMPILE_LANGUAGE:C,CXX>:-fsized-deallocation>
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=unreachable-code-aggressive>)
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wunreachable-code-aggressive>)
target_compile_definitions(
common
PRIVATE
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 16806ff0c0..8e01a67c20 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -1199,7 +1199,7 @@ if (MSVC)
)
else()
target_compile_options(core PRIVATE
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=conversion>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wconversion>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-sign-conversion>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-cast-function-type>
$<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>)
diff --git a/src/hid_core/CMakeLists.txt b/src/hid_core/CMakeLists.txt
index c740cdbe7f..e617160834 100644
--- a/src/hid_core/CMakeLists.txt
+++ b/src/hid_core/CMakeLists.txt
@@ -151,7 +151,7 @@ if (MSVC)
)
else()
target_compile_options(hid_core PRIVATE
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=conversion>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wconversion>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-sign-conversion>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-cast-function-type>
$<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>)
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index 91dd8558ab..840602f4ce 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -44,7 +44,7 @@ if (MSVC)
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
)
else()
- target_compile_options(input_common PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=conversion>)
+ target_compile_options(input_common PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:-Wconversion>)
endif()
if (ANDROID)
diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt
index d02ee268f0..1e6a4d173a 100644
--- a/src/shader_recompiler/CMakeLists.txt
+++ b/src/shader_recompiler/CMakeLists.txt
@@ -253,7 +253,7 @@ if (MSVC)
)
else()
target_compile_options(shader_recompiler PRIVATE
- $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=conversion>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wconversion>
# Bracket depth determines maximum size of a fold expression in Clang since 9c9974c3ccb6.
# And this in turns limits the size of a std::array.
$<$<CXX_COMPILER_ID:Clang>:-fbracket-depth=1024>
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index aba602c3b3..6720195c0e 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -373,7 +373,7 @@ else()
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-shadow>
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-unused-local-typedef>)
else()
- target_compile_options(video_core PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=conversion>)
+ target_compile_options(video_core PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:-Wconversion>)
endif()
target_compile_options(video_core PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-sign-conversion>)