cmake: Adjust diagnostic flags for clang-cl
This commit is contained in:
@@ -242,17 +242,21 @@ endif()
|
|||||||
|
|
||||||
include(TryAppendCFlags)
|
include(TryAppendCFlags)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Keep the following commands ordered lexicographically.
|
# For both cl and clang-cl compilers.
|
||||||
try_append_c_flags(/W3) # Production quality warning level.
|
try_append_c_flags(/W3) # Production quality warning level.
|
||||||
try_append_c_flags(/wd4146) # Disable warning C4146 "unary minus operator applied to unsigned type, result still unsigned".
|
|
||||||
try_append_c_flags(/wd4244) # Disable warning C4244 "'conversion' conversion from 'type1' to 'type2', possible loss of data".
|
|
||||||
try_append_c_flags(/wd4267) # Disable warning C4267 "'var' : conversion from 'size_t' to 'type', possible loss of data".
|
|
||||||
# Eliminate deprecation warnings for the older, less secure functions.
|
# Eliminate deprecation warnings for the older, less secure functions.
|
||||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||||
|
else()
|
||||||
|
try_append_c_flags(-Wall) # GCC >= 2.95 and probably many other compilers.
|
||||||
|
endif()
|
||||||
|
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
# Keep the following commands ordered lexicographically.
|
||||||
|
try_append_c_flags(/wd4146) # Disable warning C4146 "unary minus operator applied to unsigned type, result still unsigned".
|
||||||
|
try_append_c_flags(/wd4244) # Disable warning C4244 "'conversion' conversion from 'type1' to 'type2', possible loss of data".
|
||||||
|
try_append_c_flags(/wd4267) # Disable warning C4267 "'var' : conversion from 'size_t' to 'type', possible loss of data".
|
||||||
else()
|
else()
|
||||||
# Keep the following commands ordered lexicographically.
|
# Keep the following commands ordered lexicographically.
|
||||||
try_append_c_flags(-pedantic)
|
try_append_c_flags(-pedantic)
|
||||||
try_append_c_flags(-Wall) # GCC >= 2.95 and probably many other compilers.
|
|
||||||
try_append_c_flags(-Wcast-align) # GCC >= 2.95.
|
try_append_c_flags(-Wcast-align) # GCC >= 2.95.
|
||||||
try_append_c_flags(-Wcast-align=strict) # GCC >= 8.0.
|
try_append_c_flags(-Wcast-align=strict) # GCC >= 8.0.
|
||||||
try_append_c_flags(-Wconditional-uninitialized) # Clang >= 3.0 only.
|
try_append_c_flags(-Wconditional-uninitialized) # Clang >= 3.0 only.
|
||||||
|
|||||||
Reference in New Issue
Block a user