[llvm] r274546 - [CMake] Adjust export_executable_symbols to cope with non-target link libraries

John Brawn via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 06:16:54 PDT 2016


Author: john.brawn
Date: Tue Jul  5 08:16:54 2016
New Revision: 274546

URL: http://llvm.org/viewvc/llvm-project?rev=274546&view=rev
Log:
[CMake] Adjust export_executable_symbols to cope with non-target link libraries

export_executable_symbols looks though the link libraries of the executable in
order to figure out transitive dependencies, but in doing so it assumes that
all link libraries are also targets. This is not true as of r273302, so adjust
it to check if they actually are targets.

Modified:
    llvm/trunk/cmake/modules/AddLLVM.cmake

Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=274546&r1=274545&r2=274546&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Tue Jul  5 08:16:54 2016
@@ -695,20 +695,22 @@ function(export_executable_symbols targe
     set(link_libs ${new_libs})
     while(NOT "${new_libs}" STREQUAL "")
       foreach(lib ${new_libs})
-        get_target_property(lib_type ${lib} TYPE)
-        if("${lib_type}" STREQUAL "STATIC_LIBRARY")
-          list(APPEND static_libs ${lib})
-        else()
-          list(APPEND other_libs ${lib})
-        endif()
-        get_target_property(transitive_libs ${lib} INTERFACE_LINK_LIBRARIES)
-        foreach(transitive_lib ${transitive_libs})
-          list(FIND link_libs ${transitive_lib} idx)
-          if(TARGET ${transitive_lib} AND idx EQUAL -1)
-            list(APPEND newer_libs ${transitive_lib})
-            list(APPEND link_libs ${transitive_lib})
+        if(TARGET ${lib})
+          get_target_property(lib_type ${lib} TYPE)
+          if("${lib_type}" STREQUAL "STATIC_LIBRARY")
+            list(APPEND static_libs ${lib})
+          else()
+            list(APPEND other_libs ${lib})
           endif()
-        endforeach(transitive_lib)
+          get_target_property(transitive_libs ${lib} INTERFACE_LINK_LIBRARIES)
+          foreach(transitive_lib ${transitive_libs})
+            list(FIND link_libs ${transitive_lib} idx)
+            if(TARGET ${transitive_lib} AND idx EQUAL -1)
+              list(APPEND newer_libs ${transitive_lib})
+              list(APPEND link_libs ${transitive_lib})
+            endif()
+          endforeach(transitive_lib)
+        endif()
       endforeach(lib)
       set(new_libs ${newer_libs})
       set(newer_libs "")




More information about the llvm-commits mailing list