[libcxx-commits] [PATCH] D68880: [libc++] Use generator expression in Linker script generation

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 11 11:46:40 PDT 2019


ldionne created this revision.
ldionne added a reviewer: phosek.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous, christof, mgorny.
Herald added a reviewer: EricWF.
Herald added a project: libc++.
ldionne added a comment.
Herald added a reviewer: mclow.lists.

@phosek Can you please confirm this also fixes your issue in the Runtimes build?


This is an alternative to the workaround in r374510.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68880

Files:
  libcxx/cmake/Modules/DefineLinkerScript.cmake


Index: libcxx/cmake/Modules/DefineLinkerScript.cmake
===================================================================
--- libcxx/cmake/Modules/DefineLinkerScript.cmake
+++ libcxx/cmake/Modules/DefineLinkerScript.cmake
@@ -31,13 +31,8 @@
   set(link_libraries)
   if (interface_libs)
     foreach(lib IN LISTS interface_libs)
-      if (TARGET "${lib}" OR
-          (${lib} MATCHES "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI) OR
-          (${lib} MATCHES "unwind(_static|_shared)?" AND HAVE_LIBUNWIND))
-        list(APPEND link_libraries "${CMAKE_LINK_LIBRARY_FLAG}$<TARGET_PROPERTY:${lib},OUTPUT_NAME>")
-      else()
-        list(APPEND link_libraries "${CMAKE_LINK_LIBRARY_FLAG}${lib}")
-      endif()
+      set(libname "$<IF:$<TARGET_EXISTS:${lib}>,$<TARGET_PROPERTY:${lib},OUTPUT_NAME>,${lib}>")
+      list(APPEND link_libraries "${CMAKE_LINK_LIBRARY_FLAG}${libname}")
     endforeach()
   endif()
   string(REPLACE ";" " " link_libraries "${link_libraries}")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68880.224644.patch
Type: text/x-patch
Size: 976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191011/b8d11a50/attachment.bin>


More information about the libcxx-commits mailing list