Skip to content

Commit

Permalink
CMake: Split qt_internal_add_example into two functions
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Alexey Edelev <[email protected]>
  • Loading branch information
alcroito committed Feb 1, 2022
1 parent b954a79 commit 209438c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 209438c

Please sign in to comment.