[PATCH] D54027: [compiler-rt] Support for passing through linker flags to libc++ build

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 2 00:38:13 PDT 2018


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

This may be needed when cross-compiling to certain platforms.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54027

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
@@ -551,6 +551,9 @@
   set(PASSTHROUGH_VARIABLES
     CMAKE_C_COMPILER_TARGET
     CMAKE_CXX_COMPILER_TARGET
+    CMAKE_SHARED_LINKER_FLAGS
+    CMAKE_MODULE_LINKER_FLAGS
+    CMAKE_EXE_LINKER_FLAGS
     CMAKE_INSTALL_PREFIX
     CMAKE_MAKE_PROGRAM
     CMAKE_LINKER
@@ -563,8 +566,10 @@
     CMAKE_SYSROOT
     CMAKE_SYSTEM_NAME)
   foreach(variable ${PASSTHROUGH_VARIABLES})
-    if(${variable})
-      list(APPEND CMAKE_PASSTHROUGH_VARIABLES -D${variable}=${${variable}})
+    get_property(is_value_set CACHE ${variable} PROPERTY VALUE SET)
+    if(${is_value_set})
+      get_property(value CACHE ${variable} PROPERTY VALUE)
+      list(APPEND CMAKE_PASSTHROUGH_VARIABLES -D${variable}=${value})
     endif()
   endforeach()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54027.172316.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181102/c4b88065/attachment.bin>


More information about the llvm-commits mailing list