summaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7bb88c8ea..d7f68618c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -24,7 +24,7 @@ if (MSVC)
# Ensure that projects build with Unicode support.
add_definitions(-DUNICODE -D_UNICODE)
- # /W3 - Level 3 warnings
+ # /W4 - Level 4 warnings
# /MP - Multi-threaded compilation
# /Zi - Output debugging information
# /Zm - Specifies the precompiled header memory allocation limit
@@ -61,7 +61,7 @@ if (MSVC)
/external:W0 # Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers
# Warnings
- /W3
+ /W4
/WX
/we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled
@@ -84,12 +84,17 @@ if (MSVC)
/wd4100 # 'identifier': unreferenced formal parameter
/wd4324 # 'struct_name': structure was padded due to __declspec(align())
+ /wd4201 # nonstandard extension used : nameless struct/union
+ /wd4702 # unreachable code (when used with LTO)
)
if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS)
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format
# Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21
add_compile_options(/Z7)
+ # Avoid D9025 warning
+ string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+ string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
else()
add_compile_options(/Zi)
endif()
@@ -105,6 +110,8 @@ if (MSVC)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)
else()
add_compile_options(
+ -fwrapv
+
-Werror=all
-Werror=extra
-Werror=missing-declarations
@@ -114,19 +121,21 @@ else()
-Wno-attributes
-Wno-invalid-offsetof
-Wno-unused-parameter
-
- $<$<CXX_COMPILER_ID:Clang>:-Wno-braced-scalar-init>
- $<$<CXX_COMPILER_ID:Clang>:-Wno-unused-private-field>
- $<$<CXX_COMPILER_ID:Clang>:-Werror=shadow-uncaptured-local>
- $<$<CXX_COMPILER_ID:Clang>:-Werror=implicit-fallthrough>
- $<$<CXX_COMPILER_ID:Clang>:-Werror=type-limits>
- $<$<CXX_COMPILER_ID:AppleClang>:-Wno-braced-scalar-init>
- $<$<CXX_COMPILER_ID:AppleClang>:-Wno-unused-private-field>
)
+ if (CMAKE_CXX_COMPILER_ID MATCHES Clang) # Clang or AppleClang
+ add_compile_options(
+ -Wno-braced-scalar-init
+ -Wno-unused-private-field
+ -Wno-nullability-completeness
+ -Werror=shadow-uncaptured-local
+ -Werror=implicit-fallthrough
+ -Werror=type-limits
+ )
+ endif()
+
if (ARCHITECTURE_x86_64)
add_compile_options("-mcx16")
- add_compile_options("-fwrapv")
endif()
if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)