mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-12 18:44:59 +01:00
cmake: Adjust diagnostic flags for clang-cl
This commit is contained in:
parent
7803eb4a51
commit
88a082b2aa
3 changed files with 20 additions and 10 deletions
|
@ -411,19 +411,23 @@ include(cmake/ccache.cmake)
|
||||||
add_library(warn_interface INTERFACE)
|
add_library(warn_interface INTERFACE)
|
||||||
target_link_libraries(core_interface INTERFACE warn_interface)
|
target_link_libraries(core_interface INTERFACE warn_interface)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
# For both cl and clang-cl compilers.
|
||||||
try_append_cxx_flags("/W3" TARGET warn_interface SKIP_LINK)
|
try_append_cxx_flags("/W3" TARGET warn_interface SKIP_LINK)
|
||||||
try_append_cxx_flags("/wd4018" TARGET warn_interface SKIP_LINK)
|
|
||||||
try_append_cxx_flags("/wd4146" TARGET warn_interface SKIP_LINK)
|
|
||||||
try_append_cxx_flags("/wd4244" TARGET warn_interface SKIP_LINK)
|
|
||||||
try_append_cxx_flags("/wd4267" TARGET warn_interface SKIP_LINK)
|
|
||||||
try_append_cxx_flags("/wd4715" TARGET warn_interface SKIP_LINK)
|
|
||||||
try_append_cxx_flags("/wd4805" TARGET warn_interface SKIP_LINK)
|
|
||||||
target_compile_definitions(warn_interface INTERFACE
|
target_compile_definitions(warn_interface INTERFACE
|
||||||
_CRT_SECURE_NO_WARNINGS
|
_CRT_SECURE_NO_WARNINGS
|
||||||
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
|
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
try_append_cxx_flags("-Wall" TARGET warn_interface SKIP_LINK)
|
try_append_cxx_flags("-Wall" TARGET warn_interface SKIP_LINK)
|
||||||
|
endif()
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
try_append_cxx_flags("/wd4018" TARGET warn_interface SKIP_LINK)
|
||||||
|
try_append_cxx_flags("/wd4146" TARGET warn_interface SKIP_LINK)
|
||||||
|
try_append_cxx_flags("/wd4244" TARGET warn_interface SKIP_LINK)
|
||||||
|
try_append_cxx_flags("/wd4267" TARGET warn_interface SKIP_LINK)
|
||||||
|
try_append_cxx_flags("/wd4715" TARGET warn_interface SKIP_LINK)
|
||||||
|
try_append_cxx_flags("/wd4805" TARGET warn_interface SKIP_LINK)
|
||||||
|
else()
|
||||||
try_append_cxx_flags("-Wextra" TARGET warn_interface SKIP_LINK)
|
try_append_cxx_flags("-Wextra" TARGET warn_interface SKIP_LINK)
|
||||||
try_append_cxx_flags("-Wgnu" TARGET warn_interface SKIP_LINK)
|
try_append_cxx_flags("-Wgnu" TARGET warn_interface SKIP_LINK)
|
||||||
# Some compilers will ignore -Wformat-security without -Wformat, so just combine the two here.
|
# Some compilers will ignore -Wformat-security without -Wformat, so just combine the two here.
|
||||||
|
|
|
@ -80,12 +80,14 @@ target_include_directories(leveldb
|
||||||
|
|
||||||
add_library(nowarn_leveldb_interface INTERFACE)
|
add_library(nowarn_leveldb_interface INTERFACE)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(nowarn_leveldb_interface INTERFACE
|
|
||||||
/wd4722
|
|
||||||
)
|
|
||||||
target_compile_definitions(nowarn_leveldb_interface INTERFACE
|
target_compile_definitions(nowarn_leveldb_interface INTERFACE
|
||||||
_CRT_NONSTDC_NO_WARNINGS
|
_CRT_NONSTDC_NO_WARNINGS
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
target_compile_options(nowarn_leveldb_interface INTERFACE
|
||||||
|
/wd4722
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
try_append_cxx_flags("-Wconditional-uninitialized" TARGET nowarn_leveldb_interface SKIP_LINK
|
try_append_cxx_flags("-Wconditional-uninitialized" TARGET nowarn_leveldb_interface SKIP_LINK
|
||||||
IF_CHECK_PASSED "-Wno-conditional-uninitialized"
|
IF_CHECK_PASSED "-Wno-conditional-uninitialized"
|
||||||
|
|
|
@ -120,7 +120,11 @@ function(try_append_cxx_flags flags)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
try_append_cxx_flags("/WX /options:strict" VAR working_compiler_werror_flag SKIP_LINK)
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
try_append_cxx_flags("/WX /options:strict" VAR working_compiler_werror_flag SKIP_LINK)
|
||||||
|
else()
|
||||||
|
try_append_cxx_flags("/WX" VAR working_compiler_werror_flag SKIP_LINK)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
try_append_cxx_flags("-Werror" VAR working_compiler_werror_flag SKIP_LINK)
|
try_append_cxx_flags("-Werror" VAR working_compiler_werror_flag SKIP_LINK)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Add table
Reference in a new issue