summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-08-29 00:13:11 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-08-29 00:13:11 +0000
commit60ab090deed8213613643729a7921ef0915ac704 (patch)
tree4f21037c600edc3a73c359c84a7233ced95ad447 /CMakeLists.txt
parent80acccf4647c3482c3e3e6ae21e757ba580a5956 (diff)
downloadcompiler-rt-60ab090deed8213613643729a7921ef0915ac704.tar.gz
compiler-rt-60ab090deed8213613643729a7921ef0915ac704.tar.bz2
compiler-rt-60ab090deed8213613643729a7921ef0915ac704.tar.xz
Some flag cleanup for the sanitizer runtimes.
This hoists most of the CFLAGS into a common variable. It also adds detection for -Wno-c99-extensions and uses it to silence a pile of warnings. Finally, it switches to the proper flag -rdynamic. With this, the cmake build is warning free on my bootstrap Linux build. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162809 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc0dd486..088a59aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,6 +74,22 @@ function(filter_available_targets out_var)
set(${out_var} ${archs} PARENT_SCOPE)
endfunction()
+# Provide some common commmandline flags for Sanitizer runtimes.
+set(SANITIZER_COMMON_CFLAGS
+ -fPIC
+ -fno-exceptions
+ -funwind-tables
+ -fvisibility=hidden
+ )
+if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
+ list(APPEND SANITIZER_COMMON_CFLAGS -Wno-variadic-macros)
+endif()
+check_cxx_compiler_flag(-Wno-c99-extensions
+ SUPPORTS_NO_C99_EXTENSIONS_FLAG)
+if(SUPPORTS_NO_C99_EXTENSIONS_FLAG)
+ list(APPEND SANITIZER_COMMON_CFLAGS -Wno-c99-extensions)
+endif()
+
# Because compiler-rt spends a lot of time setting up custom compile flags,
# define a handy helper function for it. The compile flags setting in CMake
# has serious issues that make its syntax challenging at best.