summaryrefslogtreecommitdiff
path: root/cmake/Diagnostics.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Diagnostics.cmake')
-rw-r--r--cmake/Diagnostics.cmake26
1 files changed, 26 insertions, 0 deletions
diff --git a/cmake/Diagnostics.cmake b/cmake/Diagnostics.cmake
new file mode 100644
index 0000000..6dcf6bb
--- /dev/null
+++ b/cmake/Diagnostics.cmake
@@ -0,0 +1,26 @@
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ message(STATUS "Building with clang-specific diagnostics")
+
+ set(CMAKE_CXX_CLANG_TIDY clang-tidy) # See .clang-tidy files
+
+ add_compile_options(
+ # By default, enable all warnings
+ -Weverything
+ # Some warnings are incompatible with each other
+ -Wno-pre-c++20-compat-pedantic
+ -Wno-c++98-compat-pedantic
+ -Wno-switch-default
+ # Then there's code-style things I don't care about
+ -Wno-missing-designated-field-initializers
+ -Wno-shadow
+ # And functional warning I don't care about either
+ -Wno-cast-function-type-strict
+ -Wno-padded
+ # Due to C/C++ interop
+ -Wno-unsafe-buffer-usage
+ )
+ endif()
+endif()