From f3ab96c60713d63c1be83ff31ab1615eb663b84e Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sun, 3 Apr 2022 14:26:56 +0800 Subject: [PATCH] [TD-14218]: clang compile (#11231) * [TD-14218]: clang compile * [TD-14218]: clang compile check clang version --- cmake/define.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/define.inc b/cmake/define.inc index a15a0725eb..93f1d6fcbc 100755 --- a/cmake/define.inc +++ b/cmake/define.inc @@ -287,9 +287,17 @@ IF (TD_LINUX) SET(COMMON_FLAGS "${COMMON_FLAGS} -pipe -Wshadow") ENDIF () +MESSAGE(STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID}) +IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + EXECUTE_PROCESS( COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE clang_full_version_string ) + string (REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${clang_full_version_string}) + IF (CLANG_VERSION_STRING VERSION_GREATER 13.1) + SET(COMMON_FLAGS "${COMMON_FLAGS} -Wno-unused-but-set-variable") + ENDIF () +ENDIF () + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/common/inc) -MESSAGE(STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID}) -- GitLab