[test-suite] r258056 - [test-suite] Move LDFLAGS to after objects

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 18 09:24:16 PST 2016


Author: mcrosier
Date: Mon Jan 18 11:24:16 2016
New Revision: 258056

URL: http://llvm.org/viewvc/llvm-project?rev=258056&view=rev
Log:
[test-suite] Move LDFLAGS to after objects

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 by using target_link_libraries
instead of setting LINK_FLAGS.

Modified:
    test-suite/trunk/cmake/modules/SingleMultiSource.cmake

Modified: test-suite/trunk/cmake/modules/SingleMultiSource.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/SingleMultiSource.cmake?rev=258056&r1=258055&r2=258056&view=diff
==============================================================================
--- test-suite/trunk/cmake/modules/SingleMultiSource.cmake (original)
+++ test-suite/trunk/cmake/modules/SingleMultiSource.cmake Mon Jan 18 11:24:16 2016
@@ -60,18 +60,6 @@ macro(append_cflags target flags)
   endif()
 endmacro()
 
-# 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})
-  endif()
-endmacro()
-
 # llvm_add_test - Create a .test driver file suitable for LIT.
 #
 # The test template lives in cmake/lit-test-template.in and is configured by this function.
@@ -150,7 +138,7 @@ macro(llvm_singlesource)
       append_cflags(${source_exename} CFLAGS)
       append_cflags(${source_exename} CPPFLAGS)
       append_cflags(${source_exename} CXXFLAGS)
-      append_ldflags(${source_exename} LDFLAGS)
+      target_link_libraries(${source_exename} ${LDFLAGS})
       llvm_add_test(${name} ${source_exename})
       add_dependencies(${source_exename} timeit-host timeit-target fpcmp-host)
     endif()
@@ -179,7 +167,7 @@ macro(llvm_multisource)
     append_cflags(${source_exename} CFLAGS)
     append_cflags(${source_exename} CPPFLAGS)
     append_cflags(${source_exename} CXXFLAGS)
-    append_ldflags(${source_exename} LDFLAGS)
+    target_link_libraries(${source_exename} ${LDFLAGS})
     llvm_add_test(${PROG} ${source_exename})
     add_dependencies(${source_exename} timeit-host timeit-target fpcmp-host)
   endif()




More information about the llvm-commits mailing list