[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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274546 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
John Brawn 2016-07-05 13:16:54 +00:00
parent 723b0782c1
commit 3ee8690d17

View File

@ -695,20 +695,22 @@ function(export_executable_symbols target)
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 "")