summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2023-01-19 18:55:58 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2023-01-20 18:21:46 +0100
commit4e70ab5eebe16f8bc1bba26ee2f6bfdd243eb1bb (patch)
treea7b1bb4aa49cbff2f1e5a67dff5c53ea63444e70 /cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
parent9b64bf0874b9e9323d6eadad2a8023c888f25182 (diff)
CMake: Work around AUTOUIC Ninja Multi-Config issue with EP examples
AUTOUIC doesn't handle relative paths to .ui files in parent directories when using Ninja Multi-Config. The designer tool in qttools has such a ui file. This leads to the following error when trying to build qttools together with examples as ExternalProjects and Ninja Multi-Config: ninja: error: 'src/designer/src/designer/designer_autogen/ include_Debug/ui_preferencesdialog.h', needed by 'src/designer/src/designer/designer_autogen:Debug', missing and no known rule to make it Until cmake is fixed, we can work around the issue by not adding designer as a dependency when building EP examples, because no example tries to use the app. We can't exclude all apps from example dependencies because some modules use qt_internal_add_app for tools as well, which are called from public CMake API and also examples. An example of this is qtapplicationmanager. Given that we can't exclude all apps, introduce a function to allow skipping single targets when building EP examples. This will allow excluding designer specifically. The examples will now depend on a new ${repo}_src_for_examples target rather than ${repo}_src, which will exclude skipped targets. Task-number: QTBUG-90820 Task-number: QTBUG-96232 Task-number: QTBUG-110369 Change-Id: I2f900253bbf7bac917f2293ef604ab3ea8f298e1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtBuildInternals/QtBuildInternalsConfig.cmake')
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake22
1 files changed, 21 insertions, 1 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index 9d8df960d2..6214b3c389 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -287,7 +287,27 @@ function(qt_build_internals_add_toplevel_targets)
COMMENT "Building everything in ${qt_repo_targets_name}/${qt_repo_target_basename}")
add_dependencies("${qt_repo_target_name}" ${qt_repo_targets})
list(APPEND qt_repo_target_all "${qt_repo_target_name}")
+
+ # Create special dependency target for External Project examples excluding targets
+ # marked as skipped.
+ set(qt_repo_target_name
+ "${qt_repo_targets_name}_${qt_repo_target_basename}_for_examples")
+ add_custom_target("${qt_repo_target_name}")
+
+ set(unskipped_targets "")
+ foreach(target IN LISTS qt_repo_targets)
+ if(TARGET "${target}")
+ qt_internal_is_target_skipped_for_examples("${target}" is_skipped)
+ if(NOT is_skipped)
+ list(APPEND unskipped_targets "${target}")
+ endif()
+ endif()
+ endforeach()
+ if(unskipped_targets)
+ add_dependencies("${qt_repo_target_name}" ${unskipped_targets})
+ endif()
endif()
+
endforeach()
if (qt_repo_target_all)
# Note qt_repo_targets_name is different from qt_repo_target_name that is used above.
@@ -813,7 +833,7 @@ macro(qt_examples_build_begin)
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)
+ list(APPEND QT_EXAMPLE_DEPENDENCIES ${qt_repo_targets_name}_src_for_examples)
endif()
if(TARGET ${qt_repo_targets_name}_tools)