summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorPancakeTAS <pancake@mgnet.work>2026-06-12 13:21:58 +0200
committerPancakeTAS <pancake@mgnet.work>2026-06-13 14:42:06 +0200
commit54c2a13447914664fc78e1ab19ea717630873998 (patch)
treed83bca940d6d55d851c351092260394ad4eef69f /cmake
Initial commit
Diffstat (limited to '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()