CMake: Disable ExternalProject examples for -debug-and-release builds

Unfortunately when using CMake <= 3.27 together with
-debug-and-release, it's not possible to reliably build examples as
external projects due to clobbered files in the same build dir.

Disable building examples as EPs in such a case.

Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: Icea9fdab47986c2608e1952a0bbae72365ac7a62
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c668dd4044283b6eac86f7ab8177595e207567d7)
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2023-08-02 17:53:37 +02:00
parent 0c38013c71
commit ec9b70c561

View File

@ -306,7 +306,11 @@ macro(qt_internal_setup_build_examples)
"Install example sources as part of the default 'install' target" ON)
# FIXME: Support prefix builds as well QTBUG-96232
if(QT_WILL_INSTALL)
# We don't want to enable EP examples with -debug-and-release because starting with CMake 3.24
# ExternalProject_Add ends up creating build rules twice, once for each configuration, in the
# same build dir, which ends up causing various issues due to concurrent builds as well as
# clobbered CMakeCache.txt and ninja files.
if(QT_WILL_INSTALL OR QT_FEATURE_debug_and_release)
set(_qt_build_examples_as_external OFF)
else()
set(_qt_build_examples_as_external ON)