forked from OSchip/llvm-project
[CMake] Use /W3 instead of -Wall on Windows. Remove add_definitions abuse.
llvm-svn: 203786
This commit is contained in:
parent
2f45b7c492
commit
fe7e28c41f
|
@ -235,10 +235,14 @@ pythonize_bool(COMPILER_RT_DEBUG)
|
|||
#================================
|
||||
include(config-ix)
|
||||
|
||||
add_definitions_if(COMPILER_RT_HAS_WALL_FLAG -Wall)
|
||||
if(MSVC)
|
||||
append_string_if(COMPILER_RT_HAS_W3_FLAG /W3 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
else()
|
||||
append_string_if(COMPILER_RT_HAS_WALL_FLAG -Wall CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
endif()
|
||||
if(COMPILER_RT_ENABLE_WERROR)
|
||||
add_definitions_if(COMPILER_RT_HAS_WERROR_FLAG -Werror)
|
||||
add_definitions_if(COMPILER_RT_HAS_WX_FLAG /WX)
|
||||
append_string_if(COMPILER_RT_HAS_WERROR_FLAG -Werror CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
append_string_if(COMPILER_RT_HAS_WX_FLAG /WX CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
endif()
|
||||
|
||||
# Emulate C99 and C++11's __func__ for MSVC prior to 2013 CTP.
|
||||
|
|
|
@ -46,13 +46,16 @@ macro(append_if condition value)
|
|||
endif()
|
||||
endmacro()
|
||||
|
||||
# Appends value to all strings in ARGN, if the condition is true.
|
||||
macro(append_string_if condition value)
|
||||
if(${condition})
|
||||
foreach(str ${ARGN})
|
||||
set(${str} "${${str}} ${value}")
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(append_no_rtti_flag list)
|
||||
append_if(COMPILER_RT_HAS_FNO_RTTI_FLAG -fno-rtti ${list})
|
||||
append_if(COMPILER_RT_HAS_GR_FLAG /GR- ${list})
|
||||
endmacro()
|
||||
|
||||
macro(add_definitions_if condition)
|
||||
if(${condition})
|
||||
add_definitions(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
|
@ -35,6 +35,7 @@ check_cxx_compiler_flag("-Werror -Wno-gnu" COMPILER_RT_HAS_WNO_GN
|
|||
check_cxx_compiler_flag("-Werror -Wno-non-virtual-dtor" COMPILER_RT_HAS_WNO_NON_VIRTUAL_DTOR_FLAG)
|
||||
check_cxx_compiler_flag("-Werror -Wno-variadic-macros" COMPILER_RT_HAS_WNO_VARIADIC_MACROS_FLAG)
|
||||
|
||||
check_cxx_compiler_flag(/W3 COMPILER_RT_HAS_W3_FLAG)
|
||||
check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG)
|
||||
check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG)
|
||||
|
||||
|
|
Loading…
Reference in New Issue