summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-05-24 16:35:39 +1000
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-05-26 13:33:29 +0200
commitd97fd7af2bc5c89a0ad9e5fac080041b78d01179 (patch)
treeb205612447a4498a2da8b3a5804d0335108098b8
parent9b5fadb9f84666f1326281f4fbff7fbe73e9cff6 (diff)
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 <alexandru.croitor@qt.io>
-rw-r--r--CMakeLists.txt3
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake229
-rw-r--r--examples/CMakeLists.txt4
-rw-r--r--examples/corelib/ipc/CMakeLists.txt6
-rw-r--r--examples/corelib/mimetypes/CMakeLists.txt2
-rw-r--r--examples/corelib/serialization/CMakeLists.txt6
-rw-r--r--examples/corelib/threads/CMakeLists.txt8
-rw-r--r--examples/corelib/tools/CMakeLists.txt6
-rw-r--r--examples/dbus/CMakeLists.txt8
-rw-r--r--examples/dbus/remotecontrolledcar/CMakeLists.txt4
-rw-r--r--examples/embedded/CMakeLists.txt12
-rw-r--r--examples/gui/CMakeLists.txt4
-rw-r--r--examples/network/CMakeLists.txt42
-rw-r--r--examples/opengl/CMakeLists.txt26
-rw-r--r--examples/qpa/CMakeLists.txt4
-rw-r--r--examples/qtconcurrent/CMakeLists.txt10
-rw-r--r--examples/qtestlib/CMakeLists.txt10
-rw-r--r--examples/sql/CMakeLists.txt18
-rw-r--r--examples/vulkan/CMakeLists.txt10
-rw-r--r--examples/widgets/CMakeLists.txt4
-rw-r--r--examples/widgets/animation/CMakeLists.txt2
-rw-r--r--examples/widgets/desktop/CMakeLists.txt4
-rw-r--r--examples/widgets/dialogs/CMakeLists.txt14
-rw-r--r--examples/widgets/draganddrop/CMakeLists.txt10
-rw-r--r--examples/widgets/effects/CMakeLists.txt4
-rw-r--r--examples/widgets/gestures/CMakeLists.txt2
-rw-r--r--examples/widgets/graphicsview/CMakeLists.txt22
-rw-r--r--examples/widgets/itemviews/CMakeLists.txt42
-rw-r--r--examples/widgets/layouts/CMakeLists.txt8
-rw-r--r--examples/widgets/mainwindows/CMakeLists.txt12
-rw-r--r--examples/widgets/painting/CMakeLists.txt24
-rw-r--r--examples/widgets/richtext/CMakeLists.txt8
-rw-r--r--examples/widgets/scroller/CMakeLists.txt2
-rw-r--r--examples/widgets/tools/CMakeLists.txt20
-rw-r--r--examples/widgets/tools/echoplugin/CMakeLists.txt4
-rw-r--r--examples/widgets/touch/CMakeLists.txt8
-rw-r--r--examples/widgets/tutorials/CMakeLists.txt2
-rw-r--r--examples/widgets/tutorials/addressbook/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/gettingStarted/CMakeLists.txt3
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt10
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt10
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt10
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt10
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt10
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt10
-rw-r--r--examples/widgets/tutorials/modelview/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/widgets/CMakeLists.txt8
-rw-r--r--examples/widgets/widgets/CMakeLists.txt50
-rw-r--r--examples/xml/CMakeLists.txt10
49 files changed, 484 insertions, 279 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e2ae4ca29..ba0fd2d106 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -169,7 +169,4 @@ qt_build_repo_end()
if(NOT QT_BUILD_STANDALONE_TESTS AND QT_BUILD_EXAMPLES)
add_subdirectory(examples)
- if(NOT QT_BUILD_EXAMPLES_BY_DEFAULT)
- set_property(DIRECTORY examples PROPERTY EXCLUDE_FROM_ALL TRUE)
- endif()
endif()
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index a173c0bcbc..1de583ac2d 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -466,10 +466,10 @@ macro(qt_build_repo_end)
endif()
endif()
+ qt_build_internals_add_toplevel_targets()
+
if(NOT QT_SUPERBUILD)
qt_print_build_instructions()
- else()
- qt_build_internals_add_toplevel_targets()
endif()
endmacro()
@@ -521,13 +521,10 @@ macro(qt_build_repo_impl_tests)
endmacro()
macro(qt_build_repo_impl_examples)
- if(QT_BUILD_EXAMPLES AND BUILD_SHARED_LIBS
+ if(QT_BUILD_EXAMPLES
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt"
AND NOT QT_BUILD_STANDALONE_TESTS)
add_subdirectory(examples)
- if(NOT QT_BUILD_EXAMPLES_BY_DEFAULT)
- set_property(DIRECTORY examples PROPERTY EXCLUDE_FROM_ALL TRUE)
- endif()
endif()
endmacro()
@@ -659,6 +656,58 @@ macro(qt_internal_set_up_build_dir_package_paths)
endmacro()
macro(qt_examples_build_begin)
+ set(options EXTERNAL_BUILD)
+ set(singleOpts "")
+ set(multiOpts DEPENDS)
+
+ cmake_parse_arguments(arg "${options}" "${singleOpts}" "${multiOpts}" ${ARGN})
+
+ # FIXME: Support prefix builds as well
+ if(arg_EXTERNAL_BUILD AND NOT QT_WILL_INSTALL)
+ # 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
+ # 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_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
+ string(TOLOWER ${PROJECT_NAME} project_name_lower)
+ if(NOT TARGET examples)
+ if(QT_BUILD_EXAMPLES_BY_DEFAULT)
+ add_custom_target(examples ALL)
+ else()
+ add_custom_target(examples)
+ endif()
+ endif()
+ if(NOT TARGET examples_${project_name_lower})
+ add_custom_target(examples_${project_name_lower})
+ add_dependencies(examples examples_${project_name_lower})
+ endif()
+
+ include(ExternalProject)
+ else()
+ # This repo has not yet been updated to build examples in a separate
+ # build from this main build, or we can't use that arrangement yet.
+ # Build them directly as part of the main build instead for backward
+ # compatibility.
+ if(NOT BUILD_SHARED_LIBS)
+ # Ordinarily, it would be an error to call return() from within a
+ # macro(), but in this case we specifically want to return from the
+ # caller's scope if we are doing a static build and the project
+ # isn't building examples in a separate build from the main build.
+ # Configuring static builds requires tools that are not available
+ # until build time.
+ return()
+ endif()
+
+ if(NOT QT_BUILD_EXAMPLES_BY_DEFAULT)
+ set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE)
+ endif()
+ endif()
+
# Examples that are built as part of the Qt build need to use the CMake config files from the
# build dir, because they are not installed yet in a prefix build.
# Appending to CMAKE_PREFIX_PATH helps find the initial Qt6Config.cmake.
@@ -677,16 +726,28 @@ macro(qt_examples_build_begin)
endmacro()
macro(qt_examples_build_end)
- # We use AUTOMOC/UIC/RCC in the examples. Make sure to not fail on a fresh Qt build, that e.g. the moc binary does not exist yet.
+ # We use AUTOMOC/UIC/RCC in the examples. When the examples are part of the
+ # main build rather than being built in their own separate project, make
+ # sure we do not fail on a fresh Qt build (e.g. the moc binary won't exist
+ # yet because it is created at build time).
- # This function gets all targets below this directory
+ # This function gets all targets below this directory (excluding custom targets and aliases)
function(get_all_targets _result _dir)
get_property(_subdirs DIRECTORY "${_dir}" PROPERTY SUBDIRECTORIES)
foreach(_subdir IN LISTS _subdirs)
get_all_targets(${_result} "${_subdir}")
endforeach()
get_property(_sub_targets DIRECTORY "${_dir}" PROPERTY BUILDSYSTEM_TARGETS)
- set(${_result} ${${_result}} ${_sub_targets} PARENT_SCOPE)
+ set(_real_targets "")
+ if(_sub_targets)
+ foreach(__target IN LISTS _sub_targets)
+ get_target_property(target_type ${__target} TYPE)
+ if(NOT target_type STREQUAL "UTILITY" AND NOT target_type STREQUAL "ALIAS")
+ list(APPEND _real_targets ${__target})
+ endif()
+ endforeach()
+ endif()
+ set(${_result} ${${_result}} ${_real_targets} PARENT_SCOPE)
endfunction()
get_all_targets(targets "${CMAKE_CURRENT_SOURCE_DIR}")
@@ -701,6 +762,156 @@ macro(qt_examples_build_end)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ${BACKUP_CMAKE_FIND_ROOT_PATH_MODE_PACKAGE})
endmacro()
+function(qt_internal_add_example subdir)
+ # FIXME: Support building examples externally for prefix builds as well.
+ if(QT_WILL_INSTALL)
+ # Use old non-external approach
+ add_subdirectory(${subdir} ${ARGN})
+ return()
+ endif()
+
+ set(options "")
+ set(singleOpts NAME)
+ set(multiOpts "")
+
+ cmake_parse_arguments(PARSE_ARGV 1 arg "${options}" "${singleOpts}" "${multiOpts}")
+
+ if(NOT arg_NAME)
+ file(RELATIVE_PATH rel_path ${QT_EXAMPLE_BASE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
+ string(REPLACE "/" "_" arg_NAME "${rel_path}")
+ endif()
+
+ if(QtBase_BINARY_DIR)
+ # Always use the copy in the build directory, even for prefix builds.
+ # We may build examples without installing, so we can't use the
+ # install or staging area.
+ set(qt_cmake_dir ${QtBase_BINARY_DIR}/lib/cmake/${QT_CMAKE_EXPORT_NAMESPACE})
+ else()
+ # This is a per-repo build that isn't the qtbase repo, so we know that
+ # qtbase was found via find_package() and Qt6_DIR must be set
+ set(qt_cmake_dir ${${QT_CMAKE_EXPORT_NAMESPACE}_DIR})
+ endif()
+
+ set(vars_to_pass_if_defined)
+ set(var_defs)
+ if(QT_HOST_PATH OR CMAKE_CROSSCOMPILING)
+ # Android NDK forces CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to ONLY, so we
+ # can't rely on this setting here making it through to the example
+ # project.
+ # TODO: We should probably leave CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
+ # alone. It may be a leftover from earlier methods that are no
+ # longer used or that no longer need this.
+ list(APPEND var_defs
+ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${qt_cmake_dir}/qt.toolchain.cmake
+ -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE:STRING=BOTH
+ )
+ else()
+ get_filename_component(prefix_dir ${qt_cmake_dir}/../../.. ABSOLUTE)
+ list(PREPEND CMAKE_PREFIX_PATH ${prefix_dir})
+
+ # Setting CMAKE_SYSTEM_NAME affects CMAKE_CROSSCOMPILING, even if it is
+ # set to the same as the host, so it should only be set if it is different.
+ # See https://gitlab.kitware.com/cmake/cmake/-/issues/21744
+ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND
+ NOT CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
+ list(APPEND vars_to_pass_if_defined CMAKE_SYSTEM_NAME:STRING)
+ endif()
+ endif()
+
+ list(APPEND vars_to_pass_if_defined
+ CMAKE_BUILD_TYPE:STRING
+ CMAKE_PREFIX_PATH:STRING
+ CMAKE_FIND_ROOT_PATH:STRING
+ CMAKE_FIND_ROOT_PATH_MODE_PACKAGE:STRING
+ BUILD_SHARED_LIBS:BOOL
+ CMAKE_OSX_ARCHITECTURES:STRING
+ CMAKE_OSX_DEPLOYMENT_TARGET:STRING
+ CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL
+ CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH:BOOL
+ CMAKE_C_COMPILER_LAUNCHER:STRING
+ CMAKE_CXX_COMPILER_LAUNCHER:STRING
+ CMAKE_OBJC_COMPILER_LAUNCHER:STRING
+ CMAKE_OBJCXX_COMPILER_LAUNCHER:STRING
+ )
+
+ foreach(var_with_type IN LISTS vars_to_pass_if_defined)
+ string(REPLACE ":" ";" key_as_list "${var_with_type}")
+ list(GET key_as_list 0 var)
+ if(NOT DEFINED ${var})
+ continue()
+ endif()
+
+ # Preserve lists
+ string(REPLACE ";" "$<SEMICOLON>" varForGenex "${${var}}")
+
+ list(APPEND var_defs -D${var_with_type}=${varForGenex})
+ endforeach()
+
+
+ set(deps "")
+ list(REMOVE_DUPLICATES QT_EXAMPLE_DEPENDENCIES)
+ foreach(dep IN LISTS QT_EXAMPLE_DEPENDENCIES)
+ if(TARGET ${dep})
+ list(APPEND deps ${dep})
+ endif()
+ endforeach()
+
+ set(independent_args)
+ cmake_policy(PUSH)
+ if(POLICY CMP0114)
+ set(independent_args INDEPENDENT TRUE)
+ cmake_policy(SET CMP0114 NEW)
+ endif()
+
+ # The USES_TERMINAL_BUILD setting forces the build step to the console pool
+ # when using Ninja. This has two benefits:
+ #
+ # - You see build output as it is generated instead of at the end of the
+ # build step.
+ # - Only one task can use the console pool at a time, so it effectively
+ # serializes all example build steps, thereby preventing CPU
+ # over-commitment.
+ #
+ # If the loss of interactivity is not so important, one can allow CPU
+ # over-commitment for Ninja builds. This may result in better throughput,
+ # but is not allowed by default because it can make a machine almost
+ # unusable while a compilation is running.
+ set(terminal_args USES_TERMINAL_BUILD TRUE)
+ if(CMAKE_GENERATOR MATCHES "Ninja")
+ option(QT_BUILD_EXAMPLES_WITH_CPU_OVERCOMMIT
+ "Allow CPU over-commitment when building examples (Ninja only)"
+ )
+ if(QT_BUILD_EXAMPLES_WITH_CPU_OVERCOMMIT)
+ set(terminal_args)
+ endif()
+ endif()
+
+ ExternalProject_Add(${arg_NAME}
+ EXCLUDE_FROM_ALL TRUE
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ DEPENDS ${deps}
+ CMAKE_CACHE_ARGS ${var_defs}
+ ${terminal_args}
+ )
+
+ # Force configure step to re-run after we configure the main project
+ set(reconfigure_check_file ${CMAKE_CURRENT_BINARY_DIR}/reconfigure_${arg_NAME}.txt)
+ file(TOUCH ${reconfigure_check_file})
+ ExternalProject_Add_Step(${arg_NAME} reconfigure-check
+ DEPENDERS configure
+ DEPENDS ${reconfigure_check_file}
+ ${independent_args}
+ )
+
+ cmake_policy(POP)
+
+ string(TOLOWER ${PROJECT_NAME} project_name_lower)
+ add_dependencies(examples_${project_name_lower} ${arg_NAME})
+
+endfunction()
+
if ("STANDALONE_TEST" IN_LIST Qt6BuildInternals_FIND_COMPONENTS)
include(${CMAKE_CURRENT_LIST_DIR}/QtStandaloneTestTemplateProject/Main.cmake)
if (NOT PROJECT_VERSION_MAJOR)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index a48879d447..a4fb347ba5 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,6 +1,4 @@
-# Generated from examples.pro.
-
-qt_examples_build_begin()
+qt_examples_build_begin(EXTERNAL_BUILD)
add_subdirectory(corelib)
add_subdirectory(embedded)
diff --git a/examples/corelib/ipc/CMakeLists.txt b/examples/corelib/ipc/CMakeLists.txt
index 29a8d4f592..214fa4c553 100644
--- a/examples/corelib/ipc/CMakeLists.txt
+++ b/examples/corelib/ipc/CMakeLists.txt
@@ -4,9 +4,9 @@ if(NOT TARGET Qt::Widgets)
return()
endif()
if(QT_FEATURE_sharedmemory)
- add_subdirectory(sharedmemory)
+ qt_internal_add_example(sharedmemory)
endif()
if(QT_FEATURE_localserver AND TARGET Qt::Network)
- add_subdirectory(localfortuneserver)
- add_subdirectory(localfortuneclient)
+ qt_internal_add_example(localfortuneserver)
+ qt_internal_add_example(localfortuneclient)
endif()
diff --git a/examples/corelib/mimetypes/CMakeLists.txt b/examples/corelib/mimetypes/CMakeLists.txt
index ac06659362..3124006aaa 100644
--- a/examples/corelib/mimetypes/CMakeLists.txt
+++ b/examples/corelib/mimetypes/CMakeLists.txt
@@ -1,5 +1,5 @@
# Generated from mimetypes.pro.
if(TARGET Qt::Widgets)
- add_subdirectory(mimetypebrowser)
+ qt_internal_add_example(mimetypebrowser)
endif()
diff --git a/examples/corelib/serialization/CMakeLists.txt b/examples/corelib/serialization/CMakeLists.txt
index a64b5130d2..486f5d0c14 100644
--- a/examples/corelib/serialization/CMakeLists.txt
+++ b/examples/corelib/serialization/CMakeLists.txt
@@ -1,5 +1,5 @@
# Generated from serialization.pro.
-add_subdirectory(cbordump)
-add_subdirectory(convert)
-add_subdirectory(savegame)
+qt_internal_add_example(cbordump)
+qt_internal_add_example(convert)
+qt_internal_add_example(savegame)
diff --git a/examples/corelib/threads/CMakeLists.txt b/examples/corelib/threads/CMakeLists.txt
index f84700fdb4..848880d076 100644
--- a/examples/corelib/threads/CMakeLists.txt
+++ b/examples/corelib/threads/CMakeLists.txt
@@ -1,8 +1,8 @@
# Generated from threads.pro.
-add_subdirectory(semaphores)
-add_subdirectory(waitconditions)
+qt_internal_add_example(semaphores)
+qt_internal_add_example(waitconditions)
if(TARGET Qt::Widgets)
- add_subdirectory(mandelbrot)
- add_subdirectory(queuedcustomtype)
+ qt_internal_add_example(mandelbrot)
+ qt_internal_add_example(queuedcustomtype)
endif()
diff --git a/examples/corelib/tools/CMakeLists.txt b/examples/corelib/tools/CMakeLists.txt
index a9f82dfab5..27e7699f26 100644
--- a/examples/corelib/tools/CMakeLists.txt
+++ b/examples/corelib/tools/CMakeLists.txt
@@ -3,6 +3,6 @@
if(NOT TARGET Qt::Widgets)
return()
endif()
-add_subdirectory(contiguouscache)
-add_subdirectory(customtype)
-add_subdirectory(customtypesending)
+qt_internal_add_example(contiguouscache)
+qt_internal_add_example(customtype)
+qt_internal_add_example(customtypesending)
diff --git a/examples/dbus/CMakeLists.txt b/examples/dbus/CMakeLists.txt
index 065cc76022..ac941a3218 100644
--- a/examples/dbus/CMakeLists.txt
+++ b/examples/dbus/CMakeLists.txt
@@ -3,12 +3,12 @@
if(NOT TARGET Qt::DBus)
return()
endif()
-add_subdirectory(listnames)
-add_subdirectory(pingpong)
+qt_internal_add_example(listnames)
+qt_internal_add_example(pingpong)
if(QT_FEATURE_process)
- add_subdirectory(complexpingpong)
+ qt_internal_add_example(complexpingpong)
endif()
if(TARGET Qt::Widgets)
- add_subdirectory(chat)
+ qt_internal_add_example(chat)
add_subdirectory(remotecontrolledcar)
endif()
diff --git a/examples/dbus/remotecontrolledcar/CMakeLists.txt b/examples/dbus/remotecontrolledcar/CMakeLists.txt
index 4d41919962..86f9f03ccc 100644
--- a/examples/dbus/remotecontrolledcar/CMakeLists.txt
+++ b/examples/dbus/remotecontrolledcar/CMakeLists.txt
@@ -1,4 +1,4 @@
# Generated from remotecontrolledcar.pro.
-add_subdirectory(car)
-add_subdirectory(controller)
+qt_internal_add_example(car)
+qt_internal_add_example(controller)
diff --git a/examples/embedded/CMakeLists.txt b/examples/embedded/CMakeLists.txt
index 84292edccc..5f4bcc5628 100644
--- a/examples/embedded/CMakeLists.txt
+++ b/examples/embedded/CMakeLists.txt
@@ -3,9 +3,9 @@
if(NOT TARGET Qt::Gui OR (NOT embedded AND NOT x11))
return()
endif()
-add_subdirectory(styleexample)
-add_subdirectory(raycasting)
-add_subdirectory(flickable)
-add_subdirectory(digiflip)
-add_subdirectory(lightmaps)
-add_subdirectory(flightinfo)
+qt_internal_add_example(styleexample)
+qt_internal_add_example(raycasting)
+qt_internal_add_example(flickable)
+qt_internal_add_example(digiflip)
+qt_internal_add_example(lightmaps)
+qt_internal_add_example(flightinfo)
diff --git a/examples/gui/CMakeLists.txt b/examples/gui/CMakeLists.txt
index 7631777ef4..d952899f55 100644
--- a/examples/gui/CMakeLists.txt
+++ b/examples/gui/CMakeLists.txt
@@ -3,5 +3,5 @@
if(NOT TARGET Qt::Gui)
return()
endif()
-add_subdirectory(analogclock)
-add_subdirectory(rasterwindow)
+qt_internal_add_example(analogclock)
+qt_internal_add_example(rasterwindow)
diff --git a/examples/network/CMakeLists.txt b/examples/network/CMakeLists.txt
index c28c951b69..fd61e75aef 100644
--- a/examples/network/CMakeLists.txt
+++ b/examples/network/CMakeLists.txt
@@ -3,36 +3,36 @@
if(NOT TARGET Qt::Network)
return()
endif()
-add_subdirectory(download)
-add_subdirectory(downloadmanager)
+qt_internal_add_example(download)
+qt_internal_add_example(downloadmanager)
if(NOT INTEGRITY)
- add_subdirectory(dnslookup)
+ qt_internal_add_example(dnslookup)
endif()
if(TARGET Qt::Widgets)
- add_subdirectory(blockingfortuneclient)
- add_subdirectory(broadcastreceiver)
- add_subdirectory(broadcastsender)
- add_subdirectory(http)
- add_subdirectory(loopback)
- add_subdirectory(threadedfortuneserver)
- add_subdirectory(googlesuggest)
- add_subdirectory(torrent)
- add_subdirectory(multicastreceiver)
- add_subdirectory(multicastsender)
- add_subdirectory(fortuneclient)
- add_subdirectory(fortuneserver)
+ qt_internal_add_example(blockingfortuneclient)
+ qt_internal_add_example(broadcastreceiver)
+ qt_internal_add_example(broadcastsender)
+ qt_internal_add_example(http)
+ qt_internal_add_example(loopback)
+ qt_internal_add_example(threadedfortuneserver)
+ qt_internal_add_example(googlesuggest)
+ qt_internal_add_example(torrent)
+ qt_internal_add_example(multicastreceiver)
+ qt_internal_add_example(multicastsender)
+ qt_internal_add_example(fortuneclient)
+ qt_internal_add_example(fortuneserver)
endif()
if(QT_FEATURE_processenvironment AND TARGET Qt::Widgets)
- add_subdirectory(network-chat)
+ qt_internal_add_example(network-chat)
endif()
if(QT_FEATURE_ssl AND TARGET Qt::Widgets)
- add_subdirectory(securesocketclient)
+ qt_internal_add_example(securesocketclient)
endif()
if(QT_FEATURE_dtls AND TARGET Qt::Widgets)
- add_subdirectory(secureudpserver)
- add_subdirectory(secureudpclient)
+ qt_internal_add_example(secureudpserver)
+ qt_internal_add_example(secureudpclient)
endif()
if(QT_FEATURE_sctp AND TARGET Qt::Widgets)
- add_subdirectory(multistreamserver)
- add_subdirectory(multistreamclient)
+ qt_internal_add_example(multistreamserver)
+ qt_internal_add_example(multistreamclient)
endif()
diff --git a/examples/opengl/CMakeLists.txt b/examples/opengl/CMakeLists.txt
index 3d5b055b1a..af1792edd0 100644
--- a/examples/opengl/CMakeLists.txt
+++ b/examples/opengl/CMakeLists.txt
@@ -1,17 +1,17 @@
# Generated from opengl.pro.
-add_subdirectory(hellowindow)
-add_subdirectory(paintedwindow)
-add_subdirectory(openglwindow)
-add_subdirectory(qopenglwindow)
+qt_internal_add_example(hellowindow)
+qt_internal_add_example(paintedwindow)
+qt_internal_add_example(openglwindow)
+qt_internal_add_example(qopenglwindow)
if(TARGET Qt::Widgets)
- add_subdirectory(contextinfo)
- add_subdirectory(threadedqopenglwidget)
- add_subdirectory(2dpainting)
- add_subdirectory(hellogl2)
- add_subdirectory(qopenglwidget)
- add_subdirectory(cube)
- add_subdirectory(textures)
- add_subdirectory(hellogles3)
- add_subdirectory(computegles31)
+ qt_internal_add_example(contextinfo)
+ qt_internal_add_example(threadedqopenglwidget)
+ qt_internal_add_example(2dpainting)
+ qt_internal_add_example(hellogl2)
+ qt_internal_add_example(qopenglwidget)
+ qt_internal_add_example(cube)
+ qt_internal_add_example(textures)
+ qt_internal_add_example(hellogles3)
+ qt_internal_add_example(computegles31)
endif()
diff --git a/examples/qpa/CMakeLists.txt b/examples/qpa/CMakeLists.txt
index 6768aa052d..a5043f2407 100644
--- a/examples/qpa/CMakeLists.txt
+++ b/examples/qpa/CMakeLists.txt
@@ -3,5 +3,5 @@
if(NOT TARGET Qt::Gui)
return()
endif()
-add_subdirectory(windows)
-add_subdirectory(qrasterwindow)
+qt_internal_add_example(windows)
+qt_internal_add_example(qrasterwindow)
diff --git a/examples/qtconcurrent/CMakeLists.txt b/examples/qtconcurrent/CMakeLists.txt
index ed1be7ec4d..0cf2bee39c 100644
--- a/examples/qtconcurrent/CMakeLists.txt
+++ b/examples/qtconcurrent/CMakeLists.txt
@@ -4,11 +4,11 @@ if(NOT TARGET Qt::Concurrent)
return()
endif()
if(TARGET Qt::Widgets)
- add_subdirectory(imagescaling)
- add_subdirectory(progressdialog)
- add_subdirectory(runfunction)
- add_subdirectory(wordcount)
+ qt_internal_add_example(imagescaling)
+ qt_internal_add_example(progressdialog)
+ qt_internal_add_example(runfunction)
+ qt_internal_add_example(wordcount)
endif()
if(TARGET Qt::Gui)
- add_subdirectory(map)
+ qt_internal_add_example(map)
endif()
diff --git a/examples/qtestlib/CMakeLists.txt b/examples/qtestlib/CMakeLists.txt
index a3ffcd2481..84fd46acf9 100644
--- a/examples/qtestlib/CMakeLists.txt
+++ b/examples/qtestlib/CMakeLists.txt
@@ -3,8 +3,8 @@
if(NOT TARGET Qt::Widgets)
return()
endif()
-add_subdirectory(tutorial1)
-add_subdirectory(tutorial2)
-add_subdirectory(tutorial3)
-add_subdirectory(tutorial4)
-add_subdirectory(tutorial5)
+qt_internal_add_example(tutorial1)
+qt_internal_add_example(tutorial2)
+qt_internal_add_example(tutorial3)
+qt_internal_add_example(tutorial4)
+qt_internal_add_example(tutorial5)
diff --git a/examples/sql/CMakeLists.txt b/examples/sql/CMakeLists.txt
index e54fc0860f..b45fd6f7cc 100644
--- a/examples/sql/CMakeLists.txt
+++ b/examples/sql/CMakeLists.txt
@@ -3,17 +3,17 @@
if(NOT TARGET Qt::Widgets)
return()
endif()
-add_subdirectory(books)
-add_subdirectory(drilldown)
-add_subdirectory(cachedtable)
-add_subdirectory(querymodel)
-add_subdirectory(relationaltablemodel)
-add_subdirectory(sqlwidgetmapper)
-add_subdirectory(tablemodel)
+qt_internal_add_example(books)
+qt_internal_add_example(drilldown)
+qt_internal_add_example(cachedtable)
+qt_internal_add_example(querymodel)
+qt_internal_add_example(relationaltablemodel)
+qt_internal_add_example(sqlwidgetmapper)
+qt_internal_add_example(tablemodel)
if(TARGET Qt::Xml)
- add_subdirectory(masterdetail)
+ qt_internal_add_example(masterdetail)
endif()
if(NOT CMAKE_CROSSCOMPILING) # special case
- add_subdirectory(sqlbrowser)
+ qt_internal_add_example(sqlbrowser)
endif()
diff --git a/examples/vulkan/CMakeLists.txt b/examples/vulkan/CMakeLists.txt
index b00a40447a..2320faaeb3 100644
--- a/examples/vulkan/CMakeLists.txt
+++ b/examples/vulkan/CMakeLists.txt
@@ -1,11 +1,11 @@
# Generated from vulkan.pro.
-add_subdirectory(hellovulkanwindow)
-add_subdirectory(hellovulkantriangle)
-add_subdirectory(hellovulkantexture)
+qt_internal_add_example(hellovulkanwindow)
+qt_internal_add_example(hellovulkantriangle)
+qt_internal_add_example(hellovulkantexture)
if(TARGET Qt::Widgets)
- add_subdirectory(hellovulkanwidget)
+ qt_internal_add_example(hellovulkanwidget)
endif()
if(TARGET Qt::Concurrent AND TARGET Qt::Widgets)
- add_subdirectory(hellovulkancubes)
+ qt_internal_add_example(hellovulkancubes)
endif()
diff --git a/examples/widgets/CMakeLists.txt b/examples/widgets/CMakeLists.txt
index 5026a40a80..753e3b8499 100644
--- a/examples/widgets/CMakeLists.txt
+++ b/examples/widgets/CMakeLists.txt
@@ -9,7 +9,7 @@ endif()
add_subdirectory(desktop)
add_subdirectory(dialogs)
add_subdirectory(effects)
-add_subdirectory(gallery)
+qt_internal_add_example(gallery)
add_subdirectory(gestures)
add_subdirectory(graphicsview)
add_subdirectory(itemviews)
@@ -28,5 +28,5 @@ if(QT_FEATURE_cursor) # special case
add_subdirectory(mainwindows)
endif()
if(QT_FEATURE_opengl AND TARGET Qt::Gui)
- add_subdirectory(windowcontainer)
+ qt_internal_add_example(windowcontainer)
endif()
diff --git a/examples/widgets/animation/CMakeLists.txt b/examples/widgets/animation/CMakeLists.txt
index e3382787aa..70f484a778 100644
--- a/examples/widgets/animation/CMakeLists.txt
+++ b/examples/widgets/animation/CMakeLists.txt
@@ -1,3 +1,3 @@
# Generated from animation.pro.
-add_subdirectory(easing)
+qt_internal_add_example(easing)
diff --git a/examples/widgets/desktop/CMakeLists.txt b/examples/widgets/desktop/CMakeLists.txt
index a50d3c2f0a..b317205c43 100644
--- a/examples/widgets/desktop/CMakeLists.txt
+++ b/examples/widgets/desktop/CMakeLists.txt
@@ -1,4 +1,4 @@
# Generated from desktop.pro.
-add_subdirectory(screenshot)
-add_subdirectory(systray)
+qt_internal_add_example(screenshot)
+qt_internal_add_example(systray)
diff --git a/examples/widgets/dialogs/CMakeLists.txt b/examples/widgets/dialogs/CMakeLists.txt
index 354424bf1f..32f8bc29a8 100644
--- a/examples/widgets/dialogs/CMakeLists.txt
+++ b/examples/widgets/dialogs/CMakeLists.txt
@@ -1,13 +1,13 @@
# Generated from dialogs.pro.
if(QT_FEATURE_wizard)
- add_subdirectory(classwizard)
- add_subdirectory(trivialwizard)
+ qt_internal_add_example(classwizard)
+ qt_internal_add_example(trivialwizard)
endif()
-add_subdirectory(extension)
-add_subdirectory(findfiles)
-add_subdirectory(standarddialogs)
-add_subdirectory(tabdialog)
+qt_internal_add_example(extension)
+qt_internal_add_example(findfiles)
+qt_internal_add_example(standarddialogs)
+qt_internal_add_example(tabdialog)
if(QT_FEATURE_wizard AND TARGET Qt::PrintSupport)
- add_subdirectory(licensewizard)
+ qt_internal_add_example(licensewizard)
endif()
diff --git a/examples/widgets/draganddrop/CMakeLists.txt b/examples/widgets/draganddrop/CMakeLists.txt
index fbad523a73..87ba702aca 100644
--- a/examples/widgets/draganddrop/CMakeLists.txt
+++ b/examples/widgets/draganddrop/CMakeLists.txt
@@ -1,7 +1,7 @@
# Generated from draganddrop.pro.
-add_subdirectory(draggableicons)
-add_subdirectory(draggabletext)
-add_subdirectory(dropsite)
-add_subdirectory(fridgemagnets)
-add_subdirectory(puzzle)
+qt_internal_add_example(draggableicons)
+qt_internal_add_example(draggabletext)
+qt_internal_add_example(dropsite)
+qt_internal_add_example(fridgemagnets)
+qt_internal_add_example(puzzle)
diff --git a/examples/widgets/effects/CMakeLists.txt b/examples/widgets/effects/CMakeLists.txt
index 6e8a892de1..1f62945f76 100644
--- a/examples/widgets/effects/CMakeLists.txt
+++ b/examples/widgets/effects/CMakeLists.txt
@@ -1,4 +1,4 @@
# Generated from effects.pro.
-add_subdirectory(blurpicker)
-add_subdirectory(fademessage)
+qt_internal_add_example(blurpicker)
+qt_internal_add_example(fademessage)
diff --git a/examples/widgets/gestures/CMakeLists.txt b/examples/widgets/gestures/CMakeLists.txt
index eb02ee41a9..34fb6d0202 100644
--- a/examples/widgets/gestures/CMakeLists.txt
+++ b/examples/widgets/gestures/CMakeLists.txt
@@ -3,4 +3,4 @@
if(NOT TARGET Qt::Widgets)
return()
endif()
-add_subdirectory(imagegestures)
+qt_internal_add_example(imagegestures)
diff --git a/examples/widgets/graphicsview/CMakeLists.txt b/examples/widgets/graphicsview/CMakeLists.txt
index a60ba190ef..961807eb55 100644
--- a/examples/widgets/graphicsview/CMakeLists.txt
+++ b/examples/widgets/graphicsview/CMakeLists.txt
@@ -1,15 +1,15 @@
# Generated from graphicsview.pro.
-add_subdirectory(chip)
-add_subdirectory(elasticnodes)
-add_subdirectory(embeddeddialogs)
-add_subdirectory(collidingmice)
-add_subdirectory(basicgraphicslayouts)
-add_subdirectory(diagramscene)
-add_subdirectory(flowlayout)
-add_subdirectory(anchorlayout)
-add_subdirectory(simpleanchorlayout)
-add_subdirectory(weatheranchorlayout)
+qt_internal_add_example(chip)
+qt_internal_add_example(elasticnodes)
+qt_internal_add_example(embeddeddialogs)
+qt_internal_add_example(collidingmice)
+qt_internal_add_example(basicgraphicslayouts)
+qt_internal_add_example(diagramscene)
+qt_internal_add_example(flowlayout)
+qt_internal_add_example(anchorlayout)
+qt_internal_add_example(simpleanchorlayout)
+qt_internal_add_example(weatheranchorlayout)
if(QT_FEATURE_cursor AND QT_FEATURE_draganddrop)
- add_subdirectory(dragdroprobot)
+ qt_internal_add_example(dragdroprobot)
endif()
diff --git a/examples/widgets/itemviews/CMakeLists.txt b/examples/widgets/itemviews/CMakeLists.txt
index 96f03a2e61..10d77c43c8 100644
--- a/examples/widgets/itemviews/CMakeLists.txt
+++ b/examples/widgets/itemviews/CMakeLists.txt
@@ -1,27 +1,27 @@
# Generated from itemviews.pro.
-add_subdirectory(addressbook)
-add_subdirectory(basicsortfiltermodel)
-add_subdirectory(chart)
-add_subdirectory(coloreditorfactory)
-add_subdirectory(combowidgetmapper)
-add_subdirectory(customsortfiltermodel)
-add_subdirectory(dirview)
-add_subdirectory(editabletreemodel)
-add_subdirectory(fetchmore)
-add_subdirectory(flattreeview)
-add_subdirectory(frozencolumn)
-add_subdirectory(interview)
-add_subdirectory(pixelator)
-add_subdirectory(simpletreemodel)
-add_subdirectory(simplewidgetmapper)
-add_subdirectory(spinboxdelegate)
-add_subdirectory(spreadsheet)
-add_subdirectory(stardelegate)
-add_subdirectory(storageview)
+qt_internal_add_example(addressbook)
+qt_internal_add_example(basicsortfiltermodel)
+qt_internal_add_example(chart)
+qt_internal_add_example(coloreditorfactory)
+qt_internal_add_example(combowidgetmapper)
+qt_internal_add_example(customsortfiltermodel)
+qt_internal_add_example(dirview)
+qt_internal_add_example(editabletreemodel)
+qt_internal_add_example(fetchmore)
+qt_internal_add_example(flattreeview)
+qt_internal_add_example(frozencolumn)
+qt_internal_add_example(interview)
+qt_internal_add_example(pixelator)
+qt_internal_add_example(simpletreemodel)
+qt_internal_add_example(simplewidgetmapper)
+qt_internal_add_example(spinboxdelegate)
+qt_internal_add_example(spreadsheet)
+qt_internal_add_example(stardelegate)
+qt_internal_add_example(storageview)
if(QT_FEATURE_draganddrop)
- add_subdirectory(puzzle)
+ qt_internal_add_example(puzzle)
endif()
if(TARGET Qt::Xml)
- add_subdirectory(simpledommodel)
+ qt_internal_add_example(simpledommodel)
endif()
diff --git a/examples/widgets/layouts/CMakeLists.txt b/examples/widgets/layouts/CMakeLists.txt
index eaca669248..656b602650 100644
--- a/examples/widgets/layouts/CMakeLists.txt
+++ b/examples/widgets/layouts/CMakeLists.txt
@@ -1,6 +1,6 @@
# Generated from layouts.pro.
-add_subdirectory(basiclayouts)
-add_subdirectory(borderlayout)
-add_subdirectory(dynamiclayouts)
-add_subdirectory(flowlayout)
+qt_internal_add_example(basiclayouts)
+qt_internal_add_example(borderlayout)
+qt_internal_add_example(dynamiclayouts)
+qt_internal_add_example(flowlayout)
diff --git a/examples/widgets/mainwindows/CMakeLists.txt b/examples/widgets/mainwindows/CMakeLists.txt
index 8bb5f52f92..ba87029ef8 100644
--- a/examples/widgets/mainwindows/CMakeLists.txt
+++ b/examples/widgets/mainwindows/CMakeLists.txt
@@ -1,8 +1,8 @@
# Generated from mainwindows.pro.
-add_subdirectory(application)
-add_subdirectory(dockwidgets)
-add_subdirectory(mainwindow)
-add_subdirectory(mdi)
-add_subdirectory(menus)
-add_subdirectory(sdi)
+qt_internal_add_example(application)
+qt_internal_add_example(dockwidgets)
+qt_internal_add_example(mainwindow)
+qt_internal_add_example(mdi)
+qt_internal_add_example(menus)
+qt_internal_add_example(sdi)
diff --git a/examples/widgets/painting/CMakeLists.txt b/examples/widgets/painting/CMakeLists.txt
index 8a106982cf..40ebafdc31 100644
--- a/examples/widgets/painting/CMakeLists.txt
+++ b/examples/widgets/painting/CMakeLists.txt
@@ -1,14 +1,14 @@
# Generated from painting.pro.
-add_subdirectory(shared) # special case
-add_subdirectory(basicdrawing)
-add_subdirectory(concentriccircles)
-add_subdirectory(affine)
-# add_subdirectory(composition) # special case FIXME: Seems buggy wrt. usesOpenGL function
-add_subdirectory(deform)
-add_subdirectory(gradients)
-add_subdirectory(pathstroke)
-add_subdirectory(imagecomposition)
-add_subdirectory(painterpaths)
-add_subdirectory(transformations)
-add_subdirectory(fontsampler)
+#add_subdirectory(shared) # special case pulled in by other subdirs as needed
+qt_internal_add_example(basicdrawing)
+qt_internal_add_example(concentriccircles)
+qt_internal_add_example(affine)
+# qt_internal_add_example(composition) # special case FIXME: Seems buggy wrt. usesOpenGL function
+qt_internal_add_example(deform)
+qt_internal_add_example(gradients)
+qt_internal_add_example(pathstroke)
+qt_internal_add_example(imagecomposition)
+qt_internal_add_example(painterpaths)
+qt_internal_add_example(transformations)
+qt_internal_add_example(fontsampler)
diff --git a/examples/widgets/richtext/CMakeLists.txt b/examples/widgets/richtext/CMakeLists.txt
index adb98e38f9..86bbcccea5 100644
--- a/examples/widgets/richtext/CMakeLists.txt
+++ b/examples/widgets/richtext/CMakeLists.txt
@@ -1,6 +1,6 @@
# Generated from richtext.pro.
-add_subdirectory(calendar)
-add_subdirectory(orderform)
-add_subdirectory(syntaxhighlighter)
-add_subdirectory(textedit)
+qt_internal_add_example(calendar)
+qt_internal_add_example(orderform)
+qt_internal_add_example(syntaxhighlighter)
+qt_internal_add_example(textedit)
diff --git a/examples/widgets/scroller/CMakeLists.txt b/examples/widgets/scroller/CMakeLists.txt
index f663cd9890..37ee7ea08f 100644
--- a/examples/widgets/scroller/CMakeLists.txt
+++ b/examples/widgets/scroller/CMakeLists.txt
@@ -1,3 +1,3 @@
# Generated from scroller.pro.
-add_subdirectory(graphicsview)
+qt_internal_add_example(graphicsview)
diff --git a/examples/widgets/tools/CMakeLists.txt b/examples/widgets/tools/CMakeLists.txt
index 72bc4cc44b..0056518f1e 100644
--- a/examples/widgets/tools/CMakeLists.txt
+++ b/examples/widgets/tools/CMakeLists.txt
@@ -1,22 +1,22 @@
# Generated from tools.pro.
-add_subdirectory(completer)
-add_subdirectory(customcompleter)
+qt_internal_add_example(completer)
+qt_internal_add_example(customcompleter)
if(QT_FEATURE_translation) # special case
- add_subdirectory(i18n)
+ qt_internal_add_example(i18n)
endif()
-add_subdirectory(regularexpression)
-add_subdirectory(settingseditor)
-add_subdirectory(styleplugin)
-add_subdirectory(treemodelcompleter)
-add_subdirectory(undo)
-add_subdirectory(undoframework)
+qt_internal_add_example(regularexpression)
+qt_internal_add_example(settingseditor)
+qt_internal_add_example(styleplugin)
+qt_internal_add_example(treemodelcompleter)
+qt_internal_add_example(undo)
+qt_internal_add_example(undoframework)
if(QT_FEATURE_library) # special case
add_subdirectory(echoplugin)
# special case begin
if(QT_FEATURE_inputdialog)
- add_subdirectory(plugandpaint)
+ qt_internal_add_example(plugandpaint)
endif()
# special case end
endif()
diff --git a/examples/widgets/tools/echoplugin/CMakeLists.txt b/examples/widgets/tools/echoplugin/CMakeLists.txt
index b848e08e72..380cfcae8e 100644
--- a/examples/widgets/tools/echoplugin/CMakeLists.txt
+++ b/examples/widgets/tools/echoplugin/CMakeLists.txt
@@ -1,4 +1,4 @@
# Generated from echoplugin.pro.
-add_subdirectory(echowindow)
-add_subdirectory(plugin)
+qt_internal_add_example(echowindow)
+qt_internal_add_example(plugin)
diff --git a/examples/widgets/touch/CMakeLists.txt b/examples/widgets/touch/CMakeLists.txt
index d2c3152ad8..ca6ef7fcb8 100644
--- a/examples/widgets/touch/CMakeLists.txt
+++ b/examples/widgets/touch/CMakeLists.txt
@@ -3,7 +3,7 @@
if(NOT TARGET Qt::Widgets)
return()
endif()
-add_subdirectory(pinchzoom)
-add_subdirectory(fingerpaint)
-add_subdirectory(knobs)
-add_subdirectory(dials)
+qt_internal_add_example(pinchzoom)
+qt_internal_add_example(fingerpaint)
+qt_internal_add_example(knobs)
+qt_internal_add_example(dials)
diff --git a/examples/widgets/tutorials/CMakeLists.txt b/examples/widgets/tutorials/CMakeLists.txt
index c2fa4a81d7..733eb42151 100644
--- a/examples/widgets/tutorials/CMakeLists.txt
+++ b/examples/widgets/tutorials/CMakeLists.txt
@@ -4,4 +4,4 @@ add_subdirectory(addressbook)
add_subdirectory(widgets)
add_subdirectory(modelview)
add_subdirectory(gettingStarted)
-add_subdirectory(notepad)
+qt_internal_add_example(notepad)
diff --git a/examples/widgets/tutorials/addressbook/CMakeLists.txt b/examples/widgets/tutorials/addressbook/CMakeLists.txt
index a8823d059a..cb00cbc084 100644
--- a/examples/widgets/tutorials/addressbook/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/CMakeLists.txt
@@ -1,9 +1,9 @@
# Generated from addressbook.pro.
-add_subdirectory(part1)
-add_subdirectory(part2)
-add_subdirectory(part3)
-add_subdirectory(part4)
-add_subdirectory(part5)
-add_subdirectory(part6)
-add_subdirectory(part7)
+qt_internal_add_example(part1)
+qt_internal_add_example(part2)
+qt_internal_add_example(part3)
+qt_internal_add_example(part4)
+qt_internal_add_example(part5)
+qt_internal_add_example(part6)
+qt_internal_add_example(part7)
diff --git a/examples/widgets/tutorials/gettingStarted/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/CMakeLists.txt
index 2aa8163029..42cac47b96 100644
--- a/examples/widgets/tutorials/gettingStarted/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/CMakeLists.txt
@@ -1,2 +1 @@
-# Generated from gettingStarted.pro.
-
+add_subdirectory(gsQt)
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt
index 7a9ade8511..8302fd7598 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt
@@ -1,7 +1,7 @@
# Generated from gsqt.pro.
-add_subdirectory(part1)
-add_subdirectory(part2)
-add_subdirectory(part3)
-add_subdirectory(part4)
-add_subdirectory(part5)
+qt_internal_add_example(part1)
+qt_internal_add_example(part2)
+qt_internal_add_example(part3)
+qt_internal_add_example(part4)
+qt_internal_add_example(part5)
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt
index e2877a26ba..13ed19067b 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt
@@ -1,7 +1,7 @@
# Generated from part1.pro.
cmake_minimum_required(VERSION 3.14)
-project(part1 LANGUAGES CXX)
+project(getting_started_part1 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(part1
+qt_add_executable(getting_started_part1
main.cpp
)
-set_target_properties(part1 PROPERTIES
+set_target_properties(getting_started_part1 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(part1 PUBLIC
+target_link_libraries(getting_started_part1 PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-install(TARGETS part1
+install(TARGETS getting_started_part1
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt
index 65a3ff3539..4f72a9ede8 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt
@@ -1,7 +1,7 @@
# Generated from part2.pro.
cmake_minimum_required(VERSION 3.14)
-project(part2 LANGUAGES CXX)
+project(getting_started_part2 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(part2
+qt_add_executable(getting_started_part2
main.cpp
)
-set_target_properties(part2 PROPERTIES
+set_target_properties(getting_started_part2 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(part2 PUBLIC
+target_link_libraries(getting_started_part2 PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-install(TARGETS part2
+install(TARGETS getting_started_part2
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt
index 4a9b79b00b..d8a72abd59 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt
@@ -1,7 +1,7 @@
# Generated from part3.pro.
cmake_minimum_required(VERSION 3.14)
-project(part3 LANGUAGES CXX)
+project(getting_started_part3 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(part3
+qt_add_executable(getting_started_part3
main.cpp
)
-set_target_properties(part3 PROPERTIES
+set_target_properties(getting_started_part3 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(part3 PUBLIC
+target_link_libraries(getting_started_part3 PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-install(TARGETS part3
+install(TARGETS getting_started_part3
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt
index b1b224c70d..3e42635ae4 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt
@@ -1,7 +1,7 @@
# Generated from part4.pro.
cmake_minimum_required(VERSION 3.14)
-project(part4 LANGUAGES CXX)
+project(getting_started_part4 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(part4
+qt_add_executable(getting_started_part4
main.cpp
)
-set_target_properties(part4 PROPERTIES
+set_target_properties(getting_started_part4 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(part4 PUBLIC
+target_link_libraries(getting_started_part4 PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-install(TARGETS part4
+install(TARGETS getting_started_part4
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt
index 182c2e9a48..c92f60d535 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}"
diff --git a/examples/widgets/tutorials/modelview/CMakeLists.txt b/examples/widgets/tutorials/modelview/CMakeLists.txt
index 10f2cf6ecf..49ca672e48 100644
--- a/examples/widgets/tutorials/modelview/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/CMakeLists.txt
@@ -1,9 +1,9 @@
# Generated from modelview.pro.
-add_subdirectory(1_readonly)
-add_subdirectory(2_formatting)
-add_subdirectory(3_changingmodel)
-add_subdirectory(4_headers)
-add_subdirectory(5_edit)
-add_subdirectory(6_treeview)
-add_subdirectory(7_selections)
+qt_internal_add_example(1_readonly)
+qt_internal_add_example(2_formatting)
+qt_internal_add_example(3_changingmodel)
+qt_internal_add_example(4_headers)
+qt_internal_add_example(5_edit)
+qt_internal_add_example(6_treeview)
+qt_internal_add_example(7_selections)
diff --git a/examples/widgets/tutorials/widgets/CMakeLists.txt b/examples/widgets/tutorials/widgets/CMakeLists.txt
index 1f4afee780..fcf0ed9ddd 100644
--- a/examples/widgets/tutorials/widgets/CMakeLists.txt
+++ b/examples/widgets/tutorials/widgets/CMakeLists.txt
@@ -1,6 +1,6 @@
# Generated from widgets.pro.
-add_subdirectory(toplevel)
-add_subdirectory(childwidget)
-add_subdirectory(windowlayout)
-add_subdirectory(nestedlayouts)
+qt_internal_add_example(toplevel)
+qt_internal_add_example(childwidget)
+qt_internal_add_example(windowlayout)
+qt_internal_add_example(nestedlayouts)
diff --git a/examples/widgets/widgets/CMakeLists.txt b/examples/widgets/widgets/CMakeLists.txt
index 8daf6a69ae..34d3d28b67 100644
--- a/examples/widgets/widgets/CMakeLists.txt
+++ b/examples/widgets/widgets/CMakeLists.txt
@@ -1,27 +1,27 @@
# Generated from widgets.pro.
-add_subdirectory(analogclock)
-add_subdirectory(calculator)
-add_subdirectory(calendarwidget)
-add_subdirectory(charactermap)
-add_subdirectory(codeeditor)
-add_subdirectory(digitalclock)
-add_subdirectory(elidedlabel)
-add_subdirectory(groupbox)
-add_subdirectory(icons)
-add_subdirectory(imageviewer)
-add_subdirectory(lineedits)
-add_subdirectory(movie)
-add_subdirectory(mousebuttons)
-add_subdirectory(scribble)
-add_subdirectory(shapedclock)
-add_subdirectory(sliders)
-add_subdirectory(spinboxes)
-add_subdirectory(styles)
-add_subdirectory(stylesheet)
-add_subdirectory(tablet)
-add_subdirectory(tetrix)
-add_subdirectory(tooltips)
-add_subdirectory(validators)
-add_subdirectory(wiggly)
-add_subdirectory(windowflags)
+qt_internal_add_example(analogclock)
+qt_internal_add_example(calculator)
+qt_internal_add_example(calendarwidget)
+qt_internal_add_example(charactermap)
+qt_internal_add_example(codeeditor)
+qt_internal_add_example(digitalclock)
+qt_internal_add_example(elidedlabel)
+qt_internal_add_example(groupbox)
+qt_internal_add_example(icons)
+qt_internal_add_example(imageviewer)
+qt_internal_add_example(lineedits)
+qt_internal_add_example(movie)
+qt_internal_add_example(mousebuttons)
+qt_internal_add_example(scribble)
+qt_internal_add_example(shapedclock)
+qt_internal_add_example(sliders)
+qt_internal_add_example(spinboxes)
+qt_internal_add_example(styles)
+qt_internal_add_example(stylesheet)
+qt_internal_add_example(tablet)
+qt_internal_add_example(tetrix)
+qt_internal_add_example(tooltips)
+qt_internal_add_example(validators)
+qt_internal_add_example(wiggly)
+qt_internal_add_example(windowflags)
diff --git a/examples/xml/CMakeLists.txt b/examples/xml/CMakeLists.txt
index 8e145b4ccb..f9fcacb31c 100644
--- a/examples/xml/CMakeLists.txt
+++ b/examples/xml/CMakeLists.txt
@@ -1,11 +1,11 @@
# Generated from xml.pro.
-add_subdirectory(htmlinfo)
-add_subdirectory(xmlstreamlint)
+qt_internal_add_example(htmlinfo)
+qt_internal_add_example(xmlstreamlint)
if(TARGET Qt::Widgets)
- add_subdirectory(dombookmarks)
- add_subdirectory(streambookmarks)
+ qt_internal_add_example(dombookmarks)
+ qt_internal_add_example(streambookmarks)
endif()
if(TARGET Qt::Network AND TARGET Qt::Widgets)
- add_subdirectory(rsslisting)
+ qt_internal_add_example(rsslisting)
endif()