diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index c3c2f197617..0d2da108ef4 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -669,8 +669,8 @@ macro(qt_examples_build_begin) cmake_parse_arguments(arg "${options}" "${singleOpts}" "${multiOpts}" ${ARGN}) - # FIXME: Support prefix builds as well - if(arg_EXTERNAL_BUILD AND NOT QT_WILL_INSTALL) + # FIXME: Support prefix builds as well QTBUG-96232 + if(arg_EXTERNAL_BUILD AND QT_BUILD_EXAMPLES_AS_EXTERNAL) # 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 diff --git a/cmake/QtBuildInternalsExtra.cmake.in b/cmake/QtBuildInternalsExtra.cmake.in index 91161b00c81..6c76c170936 100644 --- a/cmake/QtBuildInternalsExtra.cmake.in +++ b/cmake/QtBuildInternalsExtra.cmake.in @@ -69,6 +69,9 @@ set(QT_BUILD_EXAMPLES_BY_DEFAULT @QT_BUILD_EXAMPLES_BY_DEFAULT@ CACHE BOOL set(QT_BUILD_TOOLS_BY_DEFAULT @QT_BUILD_TOOLS_BY_DEFAULT@ CACHE BOOL "Should tools be built as part of the default 'all' target.") +set(QT_BUILD_EXAMPLES_AS_EXTERNAL "@QT_BUILD_EXAMPLES_AS_EXTERNAL@" CACHE BOOL + "Should examples be built as ExternalProjects.") + # Propagate usage of ccache. set(QT_USE_CCACHE @QT_USE_CCACHE@ CACHE BOOL "Enable the use of ccache") diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index 695245d66ec..4fa305431d4 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -174,6 +174,17 @@ enable_testing() option(QT_BUILD_EXAMPLES "Build Qt examples" OFF) option(QT_BUILD_EXAMPLES_BY_DEFAULT "Should examples be built as part of the default 'all' target." ON) + +# FIXME: Support prefix builds as well QTBUG-96232 +if(QT_WILL_INSTALL) + set(_qt_build_examples_as_external OFF) +else() + set(_qt_build_examples_as_external ON) +endif() +option(QT_BUILD_EXAMPLES_AS_EXTERNAL "Should examples be built as ExternalProjects." + ${_qt_build_examples_as_external}) +unset(_qt_build_examples_as_external) + option(QT_BUILD_MANUAL_TESTS "Build Qt manual tests" OFF) option(QT_BUILD_MINIMAL_STATIC_TESTS "Build minimal subset of tests for static Qt builds" OFF)