summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-06-16 14:56:13 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-16 20:33:12 +0000
commitf1276c0d10e706ab02eb76eca9c2bd96b0b80656 (patch)
tree65f348267637b25617b3043a3032e217ecf0c9d1
parent867a1816e7037d50951b674e755c44cd2d450df8 (diff)
CMake: Don't make example external projects depend on tests
Only depend on the ${project}_src and ${project}_tools targets. This might exclude some non-obivous target dependencies, but we can adjust that if needed. This reduces the build.ninja file of qtbase + qtsvg form 341MB to 41MB when configuring with tests and examples, as well as reduces the processing time of calling ninja. Amends d97fd7af2bc5c89a0ad9e5fac080041b78d01179 Change-Id: I2860d8ae89728f33f6b73fede1335cd6d6290f78 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 335123f240c0b59cc62ad151dcf185160ef33696) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake14
1 files changed, 12 insertions, 2 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index ad0025da7c..7c7832f6bc 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -672,11 +672,21 @@ macro(qt_examples_build_begin)
# Examples will be built using ExternalProject.
# We always depend on all plugins so as to prevent opportunities for
# weird errors associated with loading out-of-date plugins from
- # unrelated Qt modules. We also depend on all targets from this repo
+ # unrelated Qt modules.
+ # We also depend on all targets from this repo's src and tools subdirectories
# to ensure that we've built anything that a find_package() call within
# an example might use. Projects can add further dependencies if needed,
# but that should rarely be necessary.
- set(QT_EXAMPLE_DEPENDENCIES qt_plugins ${qt_repo_targets_name} ${arg_DEPENDS})
+ set(QT_EXAMPLE_DEPENDENCIES qt_plugins ${arg_DEPENDS})
+
+ if(TARGET ${qt_repo_targets_name}_src)
+ list(APPEND QT_EXAMPLE_DEPENDENCIES ${qt_repo_targets_name}_src)
+ endif()
+
+ if(TARGET ${qt_repo_targets_name}_tools)
+ list(APPEND QT_EXAMPLE_DEPENDENCIES ${qt_repo_targets_name}_tools)
+ endif()
+
set(QT_EXAMPLE_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
string(TOLOWER ${PROJECT_NAME} project_name_lower)