You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by tw...@apache.org on 2022/10/30 15:39:36 UTC

[incubator-kvrocks] branch unstable updated: Make compile flags more precise in CMakeLists (#1057)

This is an automated email from the ASF dual-hosted git repository.

twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 04809611 Make compile flags more precise in CMakeLists (#1057)
04809611 is described below

commit 04809611843ee12ecc9efd3f6086cc2ffc7003e3
Author: Twice <tw...@gmail.com>
AuthorDate: Sun Oct 30 23:39:31 2022 +0800

    Make compile flags more precise in CMakeLists (#1057)
---
 CMakeLists.txt | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e073b15..6e484c6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -165,8 +165,6 @@ endif()
 
 find_library(FOUND_UNWIND_LIB unwind)
 
-set(WARNING_FLAGS -Wall -Wpedantic -Wsign-compare -Wreturn-type)
-
 # kvrocks objects target
 file(GLOB_RECURSE KVROCKS_SRCS src/*.cc)
 list(FILTER KVROCKS_SRCS EXCLUDE REGEX src/main.cc)
@@ -175,7 +173,12 @@ add_library(kvrocks_objs OBJECT ${KVROCKS_SRCS})
 
 target_include_directories(kvrocks_objs PUBLIC src src/common ${PROJECT_BINARY_DIR})
 target_compile_features(kvrocks_objs PUBLIC cxx_std_17)
-target_compile_options(kvrocks_objs PUBLIC ${WARNING_FLAGS} -fno-omit-frame-pointer -Wall -Wno-pedantic -Wno-gnu-statement-expression)
+target_compile_options(kvrocks_objs PUBLIC -Wall -Wpedantic -Wsign-compare -Wreturn-type -fno-omit-frame-pointer)
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+    target_compile_options(kvrocks_objs PUBLIC -Wno-pedantic)
+elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
+    target_compile_options(kvrocks_objs PUBLIC -Wno-gnu-statement-expression)
+endif()
 target_link_libraries(kvrocks_objs PUBLIC -fno-omit-frame-pointer)
 target_link_libraries(kvrocks_objs PUBLIC ${EXTERNAL_LIBS})
 if(FOUND_UNWIND_LIB)