From 523fde0e25a5ef67d798a362328a85219b100eb1 Mon Sep 17 00:00:00 2001 From: chenjianping Date: Fri, 17 Apr 2020 02:33:37 +0000 Subject: [PATCH] eliminate securec warning --- cmake/dependency_securec.cmake | 3 +++ third_party/securec/CMakeLists.txt | 2 +- third_party/securec/src/CMakeLists.txt | 7 +++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/dependency_securec.cmake b/cmake/dependency_securec.cmake index 81714c21d4..7ff5acad06 100644 --- a/cmake/dependency_securec.cmake +++ b/cmake/dependency_securec.cmake @@ -9,6 +9,9 @@ if (NOT TARGET securec) set(_ms_tmp_CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) set(CMAKE_C_FLAGS "${SECURE_CXX_FLAGS}") + if (CMAKE_SYSTEM_NAME MATCHES "Windows") + add_compile_definitions(SECUREC_ONLY_DECLARE_MEMSET) + endif() add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/securec ${CMAKE_BINARY_DIR}/securec) set(CMAKE_POSITION_INDEPENDENT_CODE ${_ms_tmp_CMAKE_POSITION_INDEPENDENT_CODE}) set(CMAKE_C_FLAGS ${_ms_tmp_CMAKE_C_FLAGS}) diff --git a/third_party/securec/CMakeLists.txt b/third_party/securec/CMakeLists.txt index b195cc9555..99345c6eb3 100644 --- a/third_party/securec/CMakeLists.txt +++ b/third_party/securec/CMakeLists.txt @@ -9,7 +9,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) #add flags if (CMAKE_SYSTEM_NAME MATCHES "Windows") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/local/include -Wno-attributes") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/local/include") else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/local/include -Werror") endif() diff --git a/third_party/securec/src/CMakeLists.txt b/third_party/securec/src/CMakeLists.txt index 60ec0a90ee..2af0f764c8 100644 --- a/third_party/securec/src/CMakeLists.txt +++ b/third_party/securec/src/CMakeLists.txt @@ -1,3 +1,6 @@ -aux_source_directory(. SECUREC_SRCS) - +if (CMAKE_SYSTEM_NAME MATCHES "Windows") + list(APPEND SECUREC_SRCS "memset_s.c") +else() + aux_source_directory(. SECUREC_SRCS) +endif() add_library(securec STATIC ${SECUREC_SRCS})