[PATCH] D53862: [compiler-rt] Pass CMake C and C++ flags to the custom libc++

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 29 23:55:49 PDT 2018


phosek created this revision.
phosek added reviewers: vitalybuka, morehouse.
Herald added subscribers: Sanitizers, llvm-commits, mgorny, dberris.
Herald added a reviewer: EricWF.

When building the custom libc++ that's used by libFuzzer as well as
MSan and TSan tests, passthrough the C and C++ flags that were passed
to the compiler-rt CMake build. These may be needed to successfuly
compile the library on a particular platform.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53862

Files:
  compiler-rt/cmake/Modules/AddCompilerRT.cmake


Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===================================================================
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -577,9 +577,12 @@
     endif()
   endforeach()
 
-  string(REPLACE ";" " " FLAGS_STRING "${LIBCXX_CFLAGS}")
-  set(LIBCXX_C_FLAGS "${FLAGS_STRING}")
-  set(LIBCXX_CXX_FLAGS "${FLAGS_STRING}")
+  get_property(C_FLAGS CACHE CMAKE_C_FLAGS PROPERTY VALUE)
+  string(REPLACE ";" " " LIBCXX_C_FLAGS "${LIBCXX_CFLAGS}")
+  set(LIBCXX_C_FLAGS "${LIBCXX_C_FLAGS} ${C_FLAGS}")
+  get_property(CXX_FLAGS CACHE CMAKE_CXX_FLAGS PROPERTY VALUE)
+  string(REPLACE ";" " " LIBCXX_CXX_FLAGS "${LIBCXX_CFLAGS}")
+  set(LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS} ${CXX_FLAGS}")
 
   ExternalProject_Add(${name}
     DEPENDS ${name}-clobber ${LIBCXX_DEPS}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53862.171643.patch
Type: text/x-patch
Size: 855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/55a20a7d/attachment.bin>


More information about the llvm-commits mailing list