diff options
author | Alexey Samsonov <samsonov@google.com> | 2014-03-24 09:42:12 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2014-03-24 09:42:12 +0000 |
commit | 9c937cf8dfe226004f611e0f160df650d62452d1 (patch) | |
tree | 4bf3906adffed22b3e666a4c93dfb5e4adc771a4 /cmake | |
parent | b3e5621fcc27c205ac8e5060659b8056abf1018d (diff) |
[CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commands
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/CompilerRTCompile.cmake | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cmake/Modules/CompilerRTCompile.cmake b/cmake/Modules/CompilerRTCompile.cmake index bb2d08018..b3482e9ce 100644 --- a/cmake/Modules/CompilerRTCompile.cmake +++ b/cmake/Modules/CompilerRTCompile.cmake @@ -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}) |