diff options
| author | Alexey Samsonov <samsonov@google.com> | 2014-02-24 11:32:49 +0000 |
|---|---|---|
| committer | Alexey Samsonov <samsonov@google.com> | 2014-02-24 11:32:49 +0000 |
| commit | a2fee5d907ddf9eed6a7e147032ca09e6f6016b8 (patch) | |
| tree | 6345ae00817f4c79dca4c07b4bcb4d7527828c6b | |
| parent | a661a13c0fe04bd94ee40fce5e04089501dedf57 (diff) | |
| download | bcm5719-llvm-a2fee5d907ddf9eed6a7e147032ca09e6f6016b8.tar.gz bcm5719-llvm-a2fee5d907ddf9eed6a7e147032ca09e6f6016b8.zip | |
[CMake] Better support for COMPILER_RT_ENABLE_WERROR. Make sure compiler-rt libraries are build by 'make all' command
llvm-svn: 202023
| -rw-r--r-- | compiler-rt/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 6 | ||||
| -rw-r--r-- | compiler-rt/cmake/config-ix.cmake | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 6deba556a52..3af1f6aff70 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -27,7 +27,7 @@ else() endif() # Top level target used to build all compiler-rt libraries. -add_custom_target(compiler-rt) +add_custom_target(compiler-rt ALL) if (NOT COMPILER_RT_STANDALONE_BUILD) # Compute the Clang version from the LLVM version. @@ -219,7 +219,8 @@ pythonize_bool(COMPILER_RT_DEBUG) include(config-ix) if(COMPILER_RT_ENABLE_WERROR) - add_definitions(-Werror) + add_definitions_if(COMPILER_RT_HAS_WERROR_FLAG -Werror) + add_definitions_if(COMPILER_RT_HAS_WX_FLAG /WX) endif() # Provide some common commmandline flags for Sanitizer runtimes. diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index ae2d608c8b6..6c05a15d920 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -47,3 +47,9 @@ macro(append_no_rtti_flag list) append_if(${list} COMPILER_RT_HAS_FNO_RTTI_FLAG -fno-rtti) append_if(${list} COMPILER_RT_HAS_GR_FLAG /GR-) endmacro() + +macro(add_definitions_if condition) + if(${condition}) + add_definitions(${ARGN}) + endif() +endmacro() diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index 2af4ea3a630..154bd09c8c8 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -24,6 +24,7 @@ check_cxx_compiler_flag(-g COMPILER_RT_HAS_G_FLAG) check_cxx_compiler_flag(/Zi COMPILER_RT_HAS_Zi_FLAG) # Warnings. +check_cxx_compiler_flag(-Werror COMPILER_RT_HAS_WERROR_FLAG) check_cxx_compiler_flag("-Werror -Wframe-larger-than=512" COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG) check_cxx_compiler_flag("-Werror -Wglobal-constructors" COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG) check_cxx_compiler_flag("-Werror -Wno-c99-extensions" COMPILER_RT_HAS_WNO_C99_EXTENSIONS_FLAG) @@ -31,4 +32,5 @@ 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(/WX COMPILER_RT_HAS_WX_FLAG) check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG) |

