diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-06-16 14:56:13 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-06-16 20:01:30 +0200 |
commit | 335123f240c0b59cc62ad151dcf185160ef33696 (patch) | |
tree | 9d9f6781934e66a1c580712f94c5ca61412d68a8 | |
parent | 906c84a9a3f71d333e8b0772f41aab5280ab5682 (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
Pick-to: 6.2
Change-Id: I2860d8ae89728f33f6b73fede1335cd6d6290f78
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r-- | cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index 8cbd0b566f..b4acfde3ac 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -667,11 +667,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}) set(QT_IS_EXTERNAL_EXAMPLES_BUILD TRUE) |