diff --git a/CMakeLists.txt b/CMakeLists.txt index 43462e8..3f6642a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,15 @@ add_library(libblisp_obj OBJECT lib/chip/blisp_chip_bl70x.c) target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/include/) +if (NOT CMAKE_C_COMPILER_ID MATCHES "MSVC") + target_compile_options(libblisp_obj PRIVATE -Wall -Wextra -Wpedantic) +else() + # MSVC does not support 'extra' and 'pedantic' levels to warnings. + # `/Wall` seems to generate way too many non-actionable output marked as warnings. + # We settle for `/W4`. + # https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=msvc-170 + target_compile_options(libblisp_obj PRIVATE -W4) +endif() set_property(TARGET libblisp_obj PROPERTY POSITION_INDEPENDENT_CODE 1) diff --git a/tools/blisp/CMakeLists.txt b/tools/blisp/CMakeLists.txt index 66cbb40..3af2488 100644 --- a/tools/blisp/CMakeLists.txt +++ b/tools/blisp/CMakeLists.txt @@ -23,6 +23,16 @@ target_link_libraries(blisp PRIVATE argtable3::argtable3 libblisp_static file_parsers) +if (NOT CMAKE_C_COMPILER_ID MATCHES "MSVC") + target_compile_options(libblisp_obj PRIVATE -Wall -Wextra -Wpedantic) +else() + # MSVC does not support 'extra' and 'pedantic' levels to warnings. + # `/Wall` seems to generate way too many non-actionable output marked as warnings. + # We settle for `/W4`. + # https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=msvc-170 + target_compile_options(libblisp_obj PRIVATE -W4) +endif() + if (WIN32) target_link_libraries(blisp PRIVATE Setupapi.lib) elseif (APPLE)