summaryrefslogtreecommitdiff
path: root/cmake/Diagnostics.cmake
blob: 6dcf6bb97b05e5b5d2b687ef0259e3929ef86254 (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
25
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()