qt_install_lang now gather all depends libraries, and can recognize imported targets

This commit is contained in:
2020-09-07 14:39:30 +03:00
parent 61c5230ac1
commit 1548cb656f
4 changed files with 43 additions and 3 deletions

View File

@@ -708,6 +708,35 @@ macro(qt_install)
endmacro()
macro(_qt_gather_deps _T _out __p)
get_target_property(_II ${_T} IMPORTED)
if (_II)
get_target_property(_TLL${__p} ${_T} INTERFACE_LINK_LIBRARIES)
else()
get_target_property(_TLL${__p} ${_T} LINK_LIBRARIES)
endif()
#message("_qt_gather_deps ${_T} \"${__p}\" = ${_TLL${__p}}")# ${${_out}}")
foreach (_TL${__p} ${_TLL${__p}})
set(_lib ${_TL${__p}})
if (TARGET ${_lib})
get_target_property(_AT ${_lib} ALIASED_TARGET)
if (_AT)
set(_lib ${_AT})
endif()
#message("${_T} links with ${_lib}")
if (NOT _lib IN_LIST ${_out})
#message("look for ${_lib}")
list(APPEND ${_out} ${_lib})
string(MAKE_C_IDENTIFIER "${_lib}" _p)
_qt_gather_deps(${_lib} ${_out} "${_p}")
endif()
else()
#message("${_T} reject ${_lib}")
endif()
endforeach()
endmacro()
macro(qt_install_lang _NAME)
set(_prev_inst)
#message("command: ${ARGN}")
@@ -733,7 +762,9 @@ macro(qt_install_lang _NAME)
if (_${_NAME}_is_qt)
set(_target ${_NAME}${TARGET_SUFFIX_Qt${_v}})
endif()
get_target_property(_LL ${_target} LINK_LIBRARIES)
set(_LL)
_qt_gather_deps(${_target} _LL "")
#message("${_target} libs = ${_LL}")
foreach (_L ${_LL})
get_filename_component(_libname "${_L}" NAME_WE)
#message("depend on ${_libname}")
@@ -755,6 +786,15 @@ macro(qt_install_lang _NAME)
#message("qad lib \"${_libname}\"")
list(APPEND _qt_libs ${_libname})
endif()
if ("${_libname}" MATCHES ".*::.*")
string(LENGTH "${_libname}" _sl)
math(EXPR _sl ${_sl}-1)
string(SUBSTRING "${_libname}" 0 ${_sl} _libname)
string(REPLACE "::" "_" _libname "${_libname}")
string(TOLOWER "${_libname}" _libname )
#message("imp lib \"${_libname}\"")
list(APPEND _qt_libs ${_libname})
endif()
endif()
endforeach()
if (NOT "x${_qt_libs}" STREQUAL "x")