Run check_*_compiler_flag earlier

This commit is contained in:
Amos Bird 2021-05-12 12:14:00 +08:00
parent 41012b5ba4
commit d22ab2028f
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
4 changed files with 14 additions and 9 deletions

View File

@ -593,6 +593,9 @@ include_directories(${ConfigIncludePath})
# Add as many warnings as possible for our own code.
include (cmake/warnings.cmake)
# Check if needed compiler flags are supported
include (cmake/check_flags.cmake)
add_subdirectory (base)
add_subdirectory (src)
add_subdirectory (programs)

7
cmake/check_flags.cmake Normal file
View File

@ -0,0 +1,7 @@
include (CheckCXXCompilerFlag)
include (CheckCCompilerFlag)
check_cxx_compiler_flag("-Wsuggest-destructor-override" HAS_SUGGEST_DESTRUCTOR_OVERRIDE)
check_cxx_compiler_flag("-Wshadow" HAS_SHADOW)
check_cxx_compiler_flag("-Wsuggest-override" HAS_SUGGEST_OVERRIDE)
check_cxx_compiler_flag("-Wsuggest-destructor-override" HAS_SUGGEST_DESTRUCTOR_OVERRIDE)

View File

@ -3,9 +3,6 @@ add_headers_and_sources(clickhouse_functions_gatherutils .)
add_library(clickhouse_functions_gatherutils ${clickhouse_functions_gatherutils_sources} ${clickhouse_functions_gatherutils_headers})
target_link_libraries(clickhouse_functions_gatherutils PRIVATE dbms)
check_cxx_compiler_flag("-Wsuggest-override" HAS_SUGGEST_OVERRIDE)
check_cxx_compiler_flag("-Wsuggest-destructor-override" HAS_SUGGEST_DESTRUCTOR_OVERRIDE)
if (HAS_SUGGEST_OVERRIDE)
target_compile_definitions(clickhouse_functions_gatherutils PUBLIC HAS_SUGGEST_OVERRIDE)
endif()

View File

@ -50,12 +50,6 @@ set (SRCS
add_library (clickhouse_parsers_new ${SRCS})
# XXX: hack for old clang-10!
check_cxx_compiler_flag("-Wsuggest-destructor-override" HAS_SUGGEST_DESTRUCTOR_OVERRIDE)
# XXX: hack for old gcc-10!
check_cxx_compiler_flag("-Wshadow" HAS_SHADOW)
target_compile_options (clickhouse_parsers_new
PRIVATE
-Wno-c++2a-compat
@ -68,12 +62,16 @@ target_compile_options (clickhouse_parsers_new
-Wno-extra-semi
-Wno-inconsistent-missing-destructor-override
)
# XXX: hack for old clang-10!
if (HAS_SUGGEST_DESTRUCTOR_OVERRIDE)
target_compile_options (clickhouse_parsers_new
PRIVATE
-Wno-suggest-destructor-override
)
endif ()
# XXX: hack for old gcc-10!
if (HAS_SHADOW)
target_compile_options (clickhouse_parsers_new
PRIVATE