[libcxx-commits] [libcxx] 0a00a7d - [libc++] Use generator expression in Linker script generation

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 30 09:00:02 PDT 2020


Author: Louis Dionne
Date: 2020-07-30T11:59:29-04:00
New Revision: 0a00a7d57791e2bf2a5c86c09dbfb52aac57862d

URL: https://github.com/llvm/llvm-project/commit/0a00a7d57791e2bf2a5c86c09dbfb52aac57862d
DIFF: https://github.com/llvm/llvm-project/commit/0a00a7d57791e2bf2a5c86c09dbfb52aac57862d.diff

LOG: [libc++] Use generator expression in Linker script generation

This is an alternative to the workaround in 34a3b24a90c6.

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

Added: 
    

Modified: 
    libcxx/cmake/Modules/DefineLinkerScript.cmake

Removed: 
    


################################################################################
diff  --git a/libcxx/cmake/Modules/DefineLinkerScript.cmake b/libcxx/cmake/Modules/DefineLinkerScript.cmake
index 11a6ca57dfc0..41426bf06714 100644
--- a/libcxx/cmake/Modules/DefineLinkerScript.cmake
+++ b/libcxx/cmake/Modules/DefineLinkerScript.cmake
@@ -34,13 +34,8 @@ function(define_linker_script target)
       if ("${lib}" STREQUAL "cxx-headers")
         continue()
       endif()
-      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}")


        


More information about the libcxx-commits mailing list