libftdi Archives

Subject: [PATCH 09/10] msvc: quiet uninteresting warnings GREATER_EQUAL needs cmake 3.7

From: Shawn Hoffman <business@xxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Shawn Hoffman <godisgovernment@xxxxxxxxx>
Date: Wed, 10 Apr 2024 07:15:48 -0700
From: Shawn Hoffman <godisgovernment@xxxxxxxxx>

---
 CMakeLists.txt     |  2 +-
 src/CMakeLists.txt | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7c236ff..6a0f53f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
 
 message(STATUS "CMake version: ${CMAKE_VERSION}")
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fa10f3a..c0c4909 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -19,6 +19,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
+
+  # '<name>': function not inlined
+  add_compile_options(/wd4710)
+
+  # function '<name>' 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)
+
+  # '<type>': '4' bytes padding added after data member '<name>'
+  add_compile_options(/wd4820)
+
+  # conversion from '<type1>' to '<type2>', 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")
-- 
2.44.0.windows.1


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread