From 7237c81bf20571fac2f898e7e29e7be386e3270a Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 25 Jun 2021 12:39:08 +0200 Subject: Add implicit dependencies in case of topLevel build Pick-to: 6.2 Change-Id: Ic7a4096d06b05a62a01565d6e7aceac12dc73def Reviewed-by: Allan Sandfeld Jensen --- CMakeLists.txt | 5 +++++ cmake/Functions.cmake | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a3ff75cb..b5fdebc0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,11 @@ externalproject_add(libs COMMAND ${CMAKE_COMMAND} -E remove_directory ../mkspecs ) +# required for topLevel build +add_implicit_dependencies(libs Core Gui Widgets Network OpenGL + OpenGLWidgets Quick QuickWidgets Qml PrintSupport WebChannel Positioning +) + # Ensure the libs project is reconfigured if the root project is reconfigured, so that the # correct CMake and qmake support files are used when building examples, rather than # using the incomplete support files created by the root project. diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 6a8aa69cc..64f43117b 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -16,6 +16,18 @@ function(assertTargets errorResult supportResult) endif() endfunction() +function(add_implicit_dependencies target) + if(TARGET ${target}) + list(REMOVE_ITEM ARGN ${target}) + foreach(qtTarget IN ITEMS ${ARGN}) + if(TARGET Qt::${qtTarget}) + add_dependencies(${target} Qt::${qtTarget}) + endif() + endforeach() + endif() +endfunction() + + # TODO: this should be idealy in qtbase function(add_check_for_support errorResult supportResult) if(NOT DEFINED ${supportResult}) -- cgit v1.2.1