From 2cb3c3df4099297b0a0554bb482e2de04fe86b5c Mon Sep 17 00:00:00 2001 From: sanine Date: Wed, 24 Aug 2022 00:02:17 -0500 Subject: add command-line arguments --- libs/cargs/cmake/EnableWarnings.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 libs/cargs/cmake/EnableWarnings.cmake (limited to 'libs/cargs/cmake/EnableWarnings.cmake') diff --git a/libs/cargs/cmake/EnableWarnings.cmake b/libs/cargs/cmake/EnableWarnings.cmake new file mode 100755 index 0000000..bfce52f --- /dev/null +++ b/libs/cargs/cmake/EnableWarnings.cmake @@ -0,0 +1,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() \ No newline at end of file -- cgit v1.2.1