From 2e714eec137f86ca1950457d8226d8cb9b71c495 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 10 Apr 2024 07:15:48 -0700 Subject: [PATCH] msvc: quiet uninteresting warnings --- src/CMakeLists.txt | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5798ab0..ae51242 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,6 +17,33 @@ message(STATUS "Detected git snapshot version: ${SNAPSHOT_VERSION}") configure_file(ftdi_version_i.h.in "${CMAKE_CURRENT_BINARY_DIR}/ftdi_version_i.h" @ONLY) +if(MSVC) + # Disable some overly-verbose warnings activated by -Wall + + # '': function not inlined + add_compile_options(/wd4710) + + # function '' selected for automatic inline expansion + add_compile_options(/wd4711) + + # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified + add_compile_options(/wd5045) + + # '': '4' bytes padding added after data member '' + add_compile_options(/wd4820) + + # conversion from '' to '', possible loss of data + add_compile_options(/wd4242 /wd4244 /wd4267) + + # Disable warning on unsafe string functions + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) + + if(MSVC_VERSION GREATER_EQUAL 1913) + # Disable warnings from system headers + add_compile_options(/external:anglebrackets /external:W0) + endif() +endif() + # Targets set(c_sources ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.c ${CMAKE_CURRENT_SOURCE_DIR}/ftdi_stream.c CACHE INTERNAL "List of c sources" ) set(c_headers ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.h CACHE INTERNAL "List of c headers" ) -- 1.7.1