From 209438c16ab6904efeda936ceefcc0ae7d14d85f Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 14 Dec 2021 15:48:34 +0100 Subject: [PATCH] CMake: Split qt_internal_add_example into two functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Qt CI Bot Reviewed-by: Alexey Edelev --- .../QtBuildInternalsConfig.cmake | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index 632bbdc67b5..08302572b17 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)