summaryrefslogtreecommitdiff
path: root/libs/cargs/cmake/EnableWarnings.cmake
blob: bfce52fd933049095b686074120704506e4bc712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# enable warnings
function(enable_warnings target)
  if(MSVC)
    target_compile_definitions(${target} PRIVATE _CRT_SECURE_NO_WARNINGS)
    target_compile_options(${target} PRIVATE /W4)
    target_compile_options(${target} PRIVATE /WX)
  elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
    target_compile_options(${target} PRIVATE -Werror)
    target_compile_options(${target} PRIVATE -Wall)
    target_compile_options(${target} PRIVATE -Wextra)
    target_compile_options(${target} PRIVATE -Wpedantic)
    target_compile_options(${target} PRIVATE -Wno-gnu-zero-variadic-macro-arguments)
  elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
    target_compile_options(${target} PRIVATE -Wall)
    target_compile_options(${target} PRIVATE -Werror)
    target_compile_options(${target} PRIVATE -Wextra)
    target_compile_options(${target} PRIVATE -Wpedantic)
  endif()
endfunction()