summaryrefslogtreecommitdiff
path: root/cmake/Diagnostics.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Diagnostics.cmake')
-rw-r--r--cmake/Diagnostics.cmake24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmake/Diagnostics.cmake b/cmake/Diagnostics.cmake
new file mode 100644
index 0000000..f609d7d
--- /dev/null
+++ b/cmake/Diagnostics.cmake
@@ -0,0 +1,24 @@
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+ if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ message(STATUS "Building with clang-specific diagnostics")
+
+ set(CMAKE_C_CLANG_TIDY clang-tidy) # See .clang-tidy files
+
+ add_compile_options(
+ # By default, enable all warnings
+ -Weverything
+ # Ignore C-standard compliance warnings
+ -Wno-declaration-after-statement
+ -Wno-pre-c23-compat
+ -Wno-pre-c11-compat
+ -Wno-c99-compat
+ -Wno-c++-compat
+ -Wno-gnu
+ # And some other warnings
+ -Wno-unsafe-buffer-usage # Pointer math is common
+ -Wno-padded # Too noisy
+ )
+ endif()
+endif()