diff --git a/be/src/geo/CMakeLists.txt b/be/src/geo/CMakeLists.txt index d802a2bedb..0caa937a8d 100644 --- a/be/src/geo/CMakeLists.txt +++ b/be/src/geo/CMakeLists.txt @@ -29,8 +29,12 @@ add_library(Geo STATIC ${GENSRC_DIR}/geo/wkt_lex.l.cpp ${GENSRC_DIR}/geo/wkt_yacc.y.cpp ) -if (COMPILER_GCC OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "14.0.0") - target_compile_options(Geo PRIVATE -Wno-unused-but-set-variable) + +include(CheckCXXCompilerFlag) +set(WARNING_OPTION "-Wno-unused-but-set-variable") +check_cxx_compiler_flag(${WARNING_OPTION} HAS_WARNING_OPTION) +if (HAS_WARNING_OPTION) + target_compile_options(Geo PRIVATE ${WARNING_OPTION}) endif() add_custom_command( diff --git a/be/src/util/simd/vstring_function.h b/be/src/util/simd/vstring_function.h index 0e8c3d075e..f17768cf89 100644 --- a/be/src/util/simd/vstring_function.h +++ b/be/src/util/simd/vstring_function.h @@ -19,6 +19,7 @@ #include +#include #include #ifdef __aarch64__ diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh index e404757a2b..a45c5af2dd 100755 --- a/thirdparty/build-thirdparty.sh +++ b/thirdparty/build-thirdparty.sh @@ -146,8 +146,8 @@ elif [[ "${CC}" == *clang ]]; then warning_option_ignored='-Wno-option-ignored' boost_toolset='clang' libhdfs_cxx17='-std=c++1z' - clang_version="$("${CC}" -dumpversion)" - if [[ "${clang_version}" < '14.0.0' ]]; then + + if "${CC}" -xc++ "${warning_unused_but_set_variable}" /dev/null 2>&1 | grep 'unknown warning option'; then warning_unused_but_set_variable='' fi fi