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.

Pick-to: 6.2 6.3
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>
This commit is contained in:
Alexandru Croitor 2021-12-14 15:48:34 +01:00
parent b954a79e25
commit 209438c16a

View File

@ -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)