summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-12-14 15:48:34 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-02-09 11:41:37 +0100
commit273bed910c6e77170c404dbc1f54384e68b2e23b (patch)
tree758ab7c6689a526b24e1105c5fd7a96f683b68f1 /cmake
parent0a5634c4d1675cd064561fc9d9d145a847033e43 (diff)
CMake: Split qt_internal_add_example into two functions
One for building using ExternalProject_Add and one when examples are built in-tree by calling add_subdirectory directly. Change-Id: If4c5301163aefed9f15148a70a8f7014bc817ac0 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 209438c16ab6904efeda936ceefcc0ae7d14d85f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake17
1 files changed, 12 insertions, 5 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index 632bbdc67b..08302572b1 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -842,13 +842,20 @@ macro(qt_examples_build_end)
endmacro()
function(qt_internal_add_example subdir)
- # FIXME: Support building examples externally for prefix builds as well.
-
if(NOT QT_IS_EXTERNAL_EXAMPLES_BUILD)
- # Use old non-external approach
- add_subdirectory(${subdir} ${ARGN})
- return()
+ qt_internal_add_example_in_tree(${ARGV})
+ else()
+ qt_internal_add_example_external_project(${ARGV})
endif()
+endfunction()
+
+function(qt_internal_add_example_in_tree subdir)
+ # Use old non-ExternalProject approach, aka build in-tree with the Qt build.
+ add_subdirectory(${subdir} ${ARGN})
+endfunction()
+
+function(qt_internal_add_example_external_project subdir)
+ # FIXME: Support building examples externally for prefix builds as well.
set(options "")
set(singleOpts NAME)