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

llvm-svn: 274546
This commit is contained in:
John Brawn 2016-07-05 13:16:54 +00:00
parent 1e91654b38
commit 24ca18e31e
1 changed files with 15 additions and 13 deletions

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 "")