Skip to content

Commit b04d841

Browse files
committed
CI: a native build doesn't fail on Clang's warning of the feature set its own -march=native names
1 parent ac1939e commit b04d841

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|ARM64)$")
3737
else()
3838
set(BBTREE_NATIVE_FLAG -march=native)
3939
endif()
40+
# For some hosts' CPUs Clang's own `-march=native` names a feature set it
41+
# then warns of (`-Winvalid-feature-combination`: a 256-bit AVX10.1 it
42+
# promotes to 512 bits), which `-Werror` would make an error of every native
43+
# build there. The check fails for a compiler that doesn't know the warning.
44+
include(CheckCXXCompilerFlag)
45+
set(CMAKE_REQUIRED_FLAGS -Werror)
46+
check_cxx_compiler_flag(-Winvalid-feature-combination BBTREE_HAS_INVALID_FEATURE_COMBINATION_WARNING)
47+
unset(CMAKE_REQUIRED_FLAGS)
48+
if(BBTREE_HAS_INVALID_FEATURE_COMBINATION_WARNING)
49+
list(APPEND BBTREE_NATIVE_FLAG -Wno-error=invalid-feature-combination)
50+
endif()
4051
if(BBTREE_NATIVE)
4152
add_compile_options(${BBTREE_NATIVE_FLAG})
4253
endif()

0 commit comments

Comments
 (0)