[libunwind] r346820 - [CMake] Passthrough CFLAGS when checking the compiler-rt path

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 13 16:09:26 PST 2018


Author: phosek
Date: Tue Nov 13 16:09:26 2018
New Revision: 346820

URL: http://llvm.org/viewvc/llvm-project?rev=346820&view=rev
Log:
[CMake] Passthrough CFLAGS when checking the compiler-rt path

This is needed when cross-compiling for a different target since
CFLAGS may contain additional flags like -resource-dir which
change the location in which compiler-rt builtins are found.

Differential Revision: https://reviews.llvm.org/D54371

Modified:
    libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake

Modified: libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=346820&r1=346819&r2=346820&view=diff
==============================================================================
--- libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake (original)
+++ libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake Tue Nov 13 16:09:26 2018
@@ -8,6 +8,9 @@ function(find_compiler_rt_library name d
   if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_CXX_COMPILER_TARGET)
     list(APPEND CLANG_COMMAND "--target=${CMAKE_CXX_COMPILER_TARGET}")
   endif()
+  get_property(LIBUNWIND_CXX_FLAGS CACHE CMAKE_CXX_FLAGS PROPERTY VALUE)
+  string(REPLACE " " ";" LIBUNWIND_CXX_FLAGS "${LIBUNWIND_CXX_FLAGS}")
+  list(APPEND CLANG_COMMAND ${LIBUNWIND_CXX_FLAGS})
   execute_process(
       COMMAND ${CLANG_COMMAND}
       RESULT_VARIABLE HAD_ERROR




More information about the cfe-commits mailing list