From 9ea295eec315b8845463f653a629e8408117b037 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 7 Apr 2022 15:12:07 +0200 Subject: Fix detection of then webengine-system-[gn|ninja] features Regexp matching against the build dir fails if the build dir contains characters that would form a regular expression. Worse, the regex could be malformed, and configuration would abort. Also, renamed the features from webengine-system-* to webengine-build-* to reflect what they are actually used for. Task-number: QTBUG-102323 Change-Id: I1b5f2bb156aaa7797fc059517a0d18c7d1cf9fd6 Reviewed-by: Michal Klocek (cherry picked from commit f923582e8b2d73c6d05860652fb79e12784edaa5) Reviewed-by: Qt Cherry-pick Bot --- configure.cmake | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/configure.cmake b/configure.cmake index 106fe86d9..5b7a9b03a 100644 --- a/configure.cmake +++ b/configure.cmake @@ -1,4 +1,3 @@ - if(QT_CONFIGURE_RUNNING) function(assertTargets) endfunction() @@ -236,13 +235,34 @@ qt_feature("qtpdf-quick-build" PRIVATE PURPOSE "Enables building the QtPdfQuick module." CONDITION TARGET Qt::Quick AND TARGET Qt::Qml AND QT_FEATURE_qtpdf_build ) -qt_feature("webengine-system-ninja" PRIVATE + +function(qtwebengine_internal_is_file_inside_root_build_dir out_var file) + set(result ON) + if(NOT QT_CONFIGURE_RUNNING) + file(RELATIVE_PATH relpath "${WEBENGINE_ROOT_BUILD_DIR}" "${file}") + if(IS_ABSOLUTE "${relpath}" OR relpath MATCHES "^\\.\\./") + set(result OFF) + endif() + endif() + set(${out_var} ${result} PARENT_SCOPE) +endfunction() + +if(Ninja_FOUND) + qtwebengine_internal_is_file_inside_root_build_dir( + Ninja_INSIDE_WEBENGINE_ROOT_BUILD_DIR "${Ninja_EXECUTABLE}") +endif() +qt_feature("webengine-build-ninja" PRIVATE LABEL "Build Ninja" - AUTODETECT NOT Ninja_FOUND OR Ninja_EXECUTABLE MATCHES ${WEBENGINE_ROOT_BUILD_DIR} + AUTODETECT NOT Ninja_FOUND OR Ninja_INSIDE_WEBENGINE_ROOT_BUILD_DIR ) -qt_feature("webengine-system-gn" PRIVATE + +if(Gn_FOUND) + qtwebengine_internal_is_file_inside_root_build_dir( + Gn_INSIDE_WEBENGINE_ROOT_BUILD_DIR "${Gn_EXECUTABLE}") +endif() +qt_feature("webengine-build-gn" PRIVATE LABEL "Build Gn" - AUTODETECT NOT Gn_FOUND OR Gn_EXECUTABLE MATCHES ${WEBENGINE_ROOT_BUILD_DIR} + AUTODETECT NOT Gn_FOUND OR Gn_INSIDE_WEBENGINE_ROOT_BUILD_DIR ) # default assumed merge limit (should match the one in qt_cmdline.cmake) set(jumbo_merge_limit 8) @@ -550,8 +570,8 @@ endif() # > Qt WebEngine Build Features qt_configure_add_summary_section(NAME "WebEngine Repository Build Options") -qt_configure_add_summary_entry(ARGS "webengine-system-ninja") -qt_configure_add_summary_entry(ARGS "webengine-system-gn") +qt_configure_add_summary_entry(ARGS "webengine-build-ninja") +qt_configure_add_summary_entry(ARGS "webengine-build-gn") qt_configure_add_summary_entry(ARGS "webengine-jumbo-build") qt_configure_add_summary_entry(ARGS "webengine-developer-build") qt_configure_add_summary_section(NAME "Build QtWebEngine Modules") -- cgit v1.2.3