[Compiler-rt][MIPS] Fix cross build for XRAY.
Reviewers: dberris, sdardis
Subscribers: jaydeep, bhushan, llvm-commits
@@ -60,6 +60,12 @@ include_directories(../../include)
set(XRAY_CFLAGS ${SANITIZER_COMMON_CFLAGS})
set(XRAY_COMMON_DEFINITIONS XRAY_HAS_EXCEPTIONS=1)
+
+if (NOT MSVC AND NOT DEFINED TARGET_FLAGS)
+ set(TARGET_FLAGS ${CMAKE_CXX_FLAGS})
+ separate_arguments(TARGET_FLAGS)
+endif()
+
append_list_if(
COMPILER_RT_HAS_XRAY_COMPILER_FLAG XRAY_SUPPORTED=1 XRAY_COMMON_DEFINITIONS)
append_list_if(
@@ -67,7 +73,7 @@ append_list_if(
add_compiler_rt_object_libraries(RTXray
ARCHS ${XRAY_SUPPORTED_ARCH}
- SOURCES ${XRAY_SOURCES} CFLAGS ${XRAY_CFLAGS}
+ SOURCES ${XRAY_SOURCES} CFLAGS ${XRAY_CFLAGS} ${TARGET_FLAGS}
DEFS ${XRAY_COMMON_DEFINITIONS})
add_compiler_rt_component(xray)
@@ -82,7 +88,7 @@ foreach(arch ${XRAY_SUPPORTED_ARCH})
STATIC
ARCHS ${arch}
SOURCES ${${arch}_SOURCES}
- CFLAGS ${XRAY_CFLAGS}
+ CFLAGS ${XRAY_CFLAGS} ${TARGET_FLAGS}
DEFS ${XRAY_COMMON_DEFINITIONS}
OBJECT_LIBS ${XRAY_COMMON_RUNTIME_OBJECT_LIBS}
PARENT_TARGET xray)
