From e68c5ea0b5c0e8795e2c4237ea8c98b692af6ee1 Mon Sep 17 00:00:00 2001 From: Allen <38368409+AllenX2018@users.noreply.github.com> Date: Fri, 9 Aug 2019 15:41:57 +0800 Subject: [PATCH] Update CMakeLists.txt add "-Wno-format-truncation" to supress format truncation warning in cmake --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72a6f1b..4f99316 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,13 @@ include (CheckFunctionKeywords) include (CheckIncludeFiles) include (CheckTypeSize) +# supress format-truncation warning +include (CheckCCompilerFlag) +check_c_compiler_flag(-Wno-format-truncation HAS_NO_FORMAT_TRUNCATION) +if (HAS_NO_FORMAT_TRUNCATION) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format-truncation") +endif() + if (MSVC) # Turn off Microsofts "security" warnings. add_definitions( "/W3 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo" )