summaryrefslogtreecommitdiff
path: root/cmake/Diagnostics.cmake
blob: f609d7da411543f0b1b3b3ad4a44fd43c5855f38 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()