[PATCH] D16242: [test-suite] Move LDFLAGS to after objects

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 13:24:27 PST 2016


mcrosier created this revision.
mcrosier added reviewers: MatzeB, cmatthews, kristof.beyls.
mcrosier added a subscriber: llvm-commits.

LDFLAGS were previously added after other compilation flags when
linking, but not after object files. This causes an issue when
attempting to statically compile, as objects cannot pull from libraries
put before them on the link line. This change assures that LDFLAGS is
always appended after the object files.


http://reviews.llvm.org/D16242

Files:
  cmake/modules/SingleMultiSource.cmake

Index: cmake/modules/SingleMultiSource.cmake
===================================================================
--- cmake/modules/SingleMultiSource.cmake
+++ cmake/modules/SingleMultiSource.cmake
@@ -63,12 +63,9 @@
 # append_ldflags - add flags to the LDFLAGS for target.
 macro(append_ldflags target flags)
   if(NOT "${${flags}}" STREQUAL "")
-    get_target_property(old_ldflags ${target} LINK_FLAGS)
-    if(${old_ldflags} STREQUAL "old_ldflags-NOTFOUND")
-      set(old_ldflags)
-    endif()
-    string(REPLACE ";" " " s "${old_ldflags};${${flags}}")
-    set_target_properties(${target} PROPERTIES LINK_FLAGS ${s})
+    foreach(var IN LISTS ${flags})
+      target_link_libraries(${target} ${var})
+    endforeach()
   endif()
 endmacro()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16242.45029.patch
Type: text/x-patch
Size: 749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160115/8472c192/attachment.bin>


More information about the llvm-commits mailing list