From d97fd7af2bc5c89a0ad9e5fac080041b78d01179 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Mon, 24 May 2021 16:35:39 +1000 Subject: Build examples in isolated sub-builds using ExternalProject Examples are intended to show how to build against an installed Qt. Building them as part of the main build means the way the Qt targets are defined and created are not representative of an end user's build. By building them as separate projects using ExternalProject, we can more closely replicate the intended audience's environment. This should allow us to catch more problems earlier. Having examples built as part of the main build also creates problems with some static builds where a tool built by the main build is needed during configure time. This happens with other repos like qtdeclarative but not (currently) with qtbase. Converting the examples in qtbase to be built using ExternalProject is intended as a demonstrator for how other repos can do similar. Until other repos are converted, they will continue to work as they did before, with examples as part of the main build for non-static builds only. The new build-externally behavior is only supported for non-prefix builds with this change. Prefix builds will continue to use the old non-external method. Support for building examples externally in prefix builds will be a separate change. Task-number: QTBUG-90820 Fixes: QTBUG-91068 Change-Id: I2304329940568dbdb7da18d54d5595ea7d8668bc Reviewed-by: Alexandru Croitor --- .../widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/widgets/tutorials/gettingStarted/gsQt/part5') diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt index 182c2e9a483..c92f60d535b 100644 --- a/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt +++ b/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt @@ -1,7 +1,7 @@ # Generated from part5.pro. cmake_minimum_required(VERSION 3.14) -project(part5 LANGUAGES CXX) +project(getting_started_part5 LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -19,20 +19,20 @@ find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Widgets) -qt_add_executable(part5 +qt_add_executable(getting_started_part5 main.cpp ) -set_target_properties(part5 PROPERTIES +set_target_properties(getting_started_part5 PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE ) -target_link_libraries(part5 PUBLIC +target_link_libraries(getting_started_part5 PUBLIC Qt::Core Qt::Gui Qt::Widgets ) -install(TARGETS part5 +install(TARGETS getting_started_part5 RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -- cgit v1.2.3