Only export public module link dependencies for shared builds

Unless we are building under a static library configuration there is no
reason to export the dependency on private libraries.

Change-Id: I724da38495dc55cc2783d4b19c01533fc0900d22
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Leander Beernaert 2020-02-11 16:49:54 +01:00 committed by Alexandru Croitor
parent 9bab556005
commit a2eb09a377
2 changed files with 11 additions and 2 deletions

View File

@ -1024,7 +1024,14 @@ function(qt_register_target_dependencies target public_libs private_libs)
set(target_deps "")
endif()
foreach(lib IN LISTS public_libs private_libs)
# Only process private dependencies if target is a static library
get_target_property(target_type ${target} TYPE)
set(lib_list ${public_libs})
if (target_type STREQUAL "STATIC_LIBRARY")
list(APPEND lib_list ${private_libs})
endif()
foreach(lib IN LISTS lib_list)
if ("${lib}" MATCHES "^Qt::(.*)")
set(lib "${CMAKE_MATCH_1}")
if (lib STREQUAL Platform

View File

@ -68,9 +68,11 @@ function(qt_internal_create_module_depends_file target)
set(arg_HEADER_MODULE OFF)
endif()
if(NOT arg_HEADER_MODULE)
set(depends "")
if(target_type STREQUAL "STATIC_LIBRARY" AND NOT arg_HEADER_MODULE)
get_target_property(depends "${target}" LINK_LIBRARIES)
endif()
get_target_property(public_depends "${target}" INTERFACE_LINK_LIBRARIES)
# Used for collecting Qt module dependencies that should be find_package()'d in