summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-02-11 16:49:54 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-02-12 08:37:38 +0000
commita2eb09a377ff95e3f695937d893c101f9c409e75 (patch)
treeba38c139acbe2f9b8262bbd10527d6a180e28171 /cmake
parent9bab556005e4d0475eeaf1b279c1da9ddac398f3 (diff)
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>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake9
-rw-r--r--cmake/QtPostProcess.cmake4
2 files changed, 11 insertions, 2 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 25756c89d9..08bc66b358 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -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
diff --git a/cmake/QtPostProcess.cmake b/cmake/QtPostProcess.cmake
index afd1cfd1dd..19cd4b699b 100644
--- a/cmake/QtPostProcess.cmake
+++ b/cmake/QtPostProcess.cmake
@@ -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