From dab8f64b6d5d4241b678d0227355858071376496 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 31 May 2021 13:52:19 +0200 Subject: [PATCH] CMake: Be precise about EXTERNAL_BUILD check when building examples This change allows temporarily removing the EXTERNAL_BUILD option in a qt repo examples project to check how the examples behave in a non-external project build, without forcing the developer to use a prefix build. Useful to compare behavior until we've ported over prefix builds to use EXTERNAL_BUILD. Amends d97fd7af2bc5c89a0ad9e5fac080041b78d01179 Change-Id: I29b834bb5f00e1e93966caae6f816faedba76b76 Reviewed-by: Craig Scott Reviewed-by: Joerg Bornemann --- cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index ad0025da7c3..1427f5a5fcb 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -678,6 +678,7 @@ macro(qt_examples_build_begin) # but that should rarely be necessary. set(QT_EXAMPLE_DEPENDENCIES qt_plugins ${qt_repo_targets_name} ${arg_DEPENDS}) set(QT_EXAMPLE_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + set(QT_IS_EXTERNAL_EXAMPLES_BUILD TRUE) string(TOLOWER ${PROJECT_NAME} project_name_lower) if(NOT TARGET examples) @@ -769,7 +770,8 @@ endmacro() function(qt_internal_add_example subdir) # FIXME: Support building examples externally for prefix builds as well. - if(QT_WILL_INSTALL) + + if(NOT QT_IS_EXTERNAL_EXAMPLES_BUILD) # Use old non-external approach add_subdirectory(${subdir} ${ARGN}) return()