summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-05-15 15:21:11 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-05-15 15:21:11 +0000
commite7ad96d9cd81483a74d7b622f129e12fa8e2b1e3 (patch)
treee7b5b6ecccacbb6a30eefa2eb50bd86f3dc5ee58 /cmake
parentefbdbc89e6324468f944e8338001bd719d4295c5 (diff)
Teach the compiler-rt custom compilation and linking CMake rules used
for sanitizers to pass the C++ compilation and exe linking flags through from the host CMake configuration. We pass the target flags afterward, allowing them to trump flags as needed. This is particularly important when the flags direct Clang, even the just-built-Clang, toward the standard library, linker, and other tools to use. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208896 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/AddCompilerRT.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
index 781e757ce..549df4d9e 100644
--- a/cmake/Modules/AddCompilerRT.cmake
+++ b/cmake/Modules/AddCompilerRT.cmake
@@ -14,7 +14,7 @@ macro(add_compiler_rt_object_library name arch)
parse_arguments(LIB "SOURCES;CFLAGS;DEFS" "" ${ARGN})
add_library(${name}.${arch} OBJECT ${LIB_SOURCES})
set_target_compile_flags(${name}.${arch}
- ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS})
+ ${CMAKE_CXX_FLAGS} ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS})
set_property(TARGET ${name}.${arch} APPEND PROPERTY
COMPILE_DEFINITIONS ${LIB_DEFS})
else()
@@ -136,6 +136,8 @@ macro(add_compiler_rt_test test_suite test_name)
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND TEST_DEPS clang)
endif()
+ set(TEST_LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TEST_LINK_FLAGS}")
+ separate_arguments(TEST_LINK_FLAGS)
add_custom_target(${test_name}
# MSVS CL doesn't allow a space between -Fe and the output file name.
COMMAND ${COMPILER_RT_TEST_COMPILER} ${TEST_OBJECTS}