[compiler-rt] r204593 - [CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commands
Alexey Samsonov
samsonov at google.com
Mon Mar 24 02:42:13 PDT 2014
Author: samsonov
Date: Mon Mar 24 04:42:12 2014
New Revision: 204593
URL: http://llvm.org/viewvc/llvm-project?rev=204593&view=rev
Log:
[CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commands
Modified:
compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
Modified: compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake?rev=204593&r1=204592&r2=204593&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake Mon Mar 24 04:42:12 2014
@@ -11,9 +11,19 @@ macro(clang_compile object_file source)
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND SOURCE_DEPS clang)
endif()
+ string(REGEX MATCH "[.](cc|cpp)$" is_cxx ${source_rpath})
+ if(is_cxx)
+ string(REPLACE " " ";" global_flags "${CMAKE_CXX_FLAGS}")
+ else()
+ string(REPLACE " " ";" global_flags "${CMAKE_C_FLAGS}")
+ endif()
+ # Ignore unknown warnings. CMAKE_CXX_FLAGS may contain GCC-specific options
+ # which are not supported by Clang.
+ list(APPEND global_flags -Wno-unknown-warning-option)
+ set(compile_flags ${global_flags} ${SOURCE_CFLAGS})
add_custom_command(
OUTPUT ${object_file}
- COMMAND ${COMPILER_RT_TEST_COMPILER} ${SOURCE_CFLAGS} -c -o "${object_file}"
+ COMMAND ${COMPILER_RT_TEST_COMPILER} ${compile_flags} -c -o "${object_file}"
${source_rpath}
MAIN_DEPENDENCY ${source}
DEPENDS ${SOURCE_DEPS})
Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=204593&r1=204592&r2=204593&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Mon Mar 24 04:42:12 2014
@@ -26,9 +26,7 @@ set(ASAN_UNITTEST_COMMON_CFLAGS
-I${COMPILER_RT_SOURCE_DIR}/lib
-I${COMPILER_RT_SOURCE_DIR}/lib/asan
-I${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common/tests
- -Wall
-Wno-format
- -Werror
-Werror=sign-compare
-g
-O2)
@@ -146,7 +144,7 @@ macro(add_asan_tests_for_arch arch)
set(ASAN_INST_TEST_OBJECTS)
foreach(src ${ASAN_INST_TEST_SOURCES})
asan_compile(ASAN_INST_TEST_OBJECTS ${src} ${arch}
- ${ASAN_UNITTEST_INSTRUMENTED_CFLAGS} -std=c++11)
+ ${ASAN_UNITTEST_INSTRUMENTED_CFLAGS})
endforeach()
if (APPLE)
# Add Mac-specific helper.
@@ -180,7 +178,7 @@ macro(add_asan_tests_for_arch arch)
set(ASAN_NOINST_TEST_OBJECTS)
foreach(src ${ASAN_NOINST_TEST_SOURCES})
asan_compile(ASAN_NOINST_TEST_OBJECTS ${src} ${arch}
- ${ASAN_UNITTEST_COMMON_CFLAGS} -std=c++11)
+ ${ASAN_UNITTEST_COMMON_CFLAGS})
endforeach()
add_asan_test(AsanUnitTests "Asan-${arch}-Noinst-Test" ${arch}
OBJECTS ${ASAN_NOINST_TEST_OBJECTS}
@@ -191,7 +189,7 @@ macro(add_asan_tests_for_arch arch)
set(ASAN_BENCHMARKS_OBJECTS)
foreach(src ${ASAN_BENCHMARKS_SOURCES})
asan_compile(ASAN_BENCHMARKS_OBJECTS ${src} ${arch}
- ${ASAN_UNITTEST_INSTRUMENTED_CFLAGS} -std=c++11)
+ ${ASAN_UNITTEST_INSTRUMENTED_CFLAGS})
endforeach()
add_asan_test(AsanBenchmarks "Asan-${arch}-Benchmark" ${arch}
OBJECTS ${ASAN_BENCHMARKS_OBJECTS}
Modified: compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/CMakeLists.txt?rev=204593&r1=204592&r2=204593&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/msan/tests/CMakeLists.txt Mon Mar 24 04:42:12 2014
@@ -13,9 +13,9 @@ set(MSAN_LIBCXX_CFLAGS
-fsanitize-memory-track-origins
-fPIC
-Wno-\#warnings
+ -Wno-pedantic
-g
-O2
- -std=c++0x
-fstrict-aliasing
-fno-exceptions
-nostdinc++
@@ -44,7 +44,6 @@ set(MSAN_UNITTEST_COMMON_CFLAGS
-I${COMPILER_RT_SOURCE_DIR}/include
-I${COMPILER_RT_SOURCE_DIR}/lib
-I${COMPILER_RT_SOURCE_DIR}/lib/msan
- -std=c++11
-stdlib=libc++
-g
-O2
@@ -52,6 +51,9 @@ set(MSAN_UNITTEST_COMMON_CFLAGS
-fno-omit-frame-pointer
-mno-omit-leaf-frame-pointer
-Wno-deprecated-declarations
+ -Wno-unused-variable
+ -Wno-zero-length-array
+ -Werror=sign-compare
)
set(MSAN_UNITTEST_INSTRUMENTED_CFLAGS
${MSAN_UNITTEST_COMMON_CFLAGS}
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=204593&r1=204592&r2=204593&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Mon Mar 24 04:42:12 2014
@@ -37,8 +37,9 @@ set(SANITIZER_TEST_CFLAGS_COMMON
-I${COMPILER_RT_SOURCE_DIR}/lib
-I${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common
-DGTEST_HAS_RTTI=0
- -std=c++11 -O2 -g -fno-rtti
- -Wall -Werror -Werror=sign-compare)
+ -O2 -g -fno-rtti
+ -Werror=sign-compare
+ -Wno-non-virtual-dtor)
set(SANITIZER_TEST_LINK_FLAGS_COMMON
-lstdc++)
Modified: compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt?rev=204593&r1=204592&r2=204593&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt Mon Mar 24 04:42:12 2014
@@ -9,7 +9,6 @@ set(TSAN_UNITTEST_CFLAGS
${COMPILER_RT_GTEST_INCLUDE_CFLAGS}
-I${COMPILER_RT_SOURCE_DIR}/lib
-I${COMPILER_RT_SOURCE_DIR}/lib/tsan/rtl
- -std=c++11
-DGTEST_HAS_RTTI=0)
set(TSAN_RTL_HEADERS)
More information about the llvm-commits
mailing list