[compiler-rt] r203786 - [CMake] Use /W3 instead of -Wall on Windows. Remove add_definitions abuse.
Alexey Samsonov
samsonov at google.com
Thu Mar 13 04:31:10 PDT 2014
Author: samsonov
Date: Thu Mar 13 06:31:10 2014
New Revision: 203786
URL: http://llvm.org/viewvc/llvm-project?rev=203786&view=rev
Log:
[CMake] Use /W3 instead of -Wall on Windows. Remove add_definitions abuse.
Modified:
compiler-rt/trunk/CMakeLists.txt
compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
compiler-rt/trunk/cmake/config-ix.cmake
Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=203786&r1=203785&r2=203786&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Thu Mar 13 06:31:10 2014
@@ -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.
Modified: compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake?rev=203786&r1=203785&r2=203786&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake Thu Mar 13 06:31:10 2014
@@ -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()
Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=203786&r1=203785&r2=203786&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Thu Mar 13 06:31:10 2014
@@ -35,6 +35,7 @@ check_cxx_compiler_flag("-Werror -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)
More information about the llvm-commits
mailing list