From f7953cdee6eed997f1b5f3e5085dac405f3d5e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Tue, 15 Aug 2023 14:08:22 +0200 Subject: [PATCH] wasm: handle missing qconfig.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's no guarantee that qconfig.h will be present when __qt_internal_get_qt_build_emsdk_version() is called during configure, since the file is written by a file(GENERATE) call which does not write the file immediately. Handle this case and allow configure to complete. Change-Id: Iab85790f9f133fd1ba5f276cdd7bc55f9af1d980 Pick-to: 6.6 Reviewed-by: Lorn Potter Reviewed-by: Piotr WierciƄski --- cmake/QtPublicWasmToolchainHelpers.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmake/QtPublicWasmToolchainHelpers.cmake b/cmake/QtPublicWasmToolchainHelpers.cmake index ed216f1bce..4ed223ed8a 100644 --- a/cmake/QtPublicWasmToolchainHelpers.cmake +++ b/cmake/QtPublicWasmToolchainHelpers.cmake @@ -81,12 +81,16 @@ function(__qt_internal_get_qt_build_emsdk_version out_var) endif() if(EXISTS "${WASM_BUILD_DIR}/src/corelib/global/qconfig.h") file(READ "${WASM_BUILD_DIR}/src/corelib/global/qconfig.h" ver) - else() + elseif(EXISTS "${WASM_BUILD_DIR}/include/QtCore/qconfig.h") file(READ "${WASM_BUILD_DIR}/include/QtCore/qconfig.h" ver) + else() + message("qconfig.h not found, unable to determine Qt build Emscripten version") + endif() + if (ver) + string(REGEX MATCH "#define QT_EMCC_VERSION.\"[0-9]+\\.[0-9]+\\.[0-9]+\"" emOutput ${ver}) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" build_emcc_version "${emOutput}") + set(${out_var} "${build_emcc_version}" PARENT_SCOPE) endif() - string(REGEX MATCH "#define QT_EMCC_VERSION.\"[0-9]+\\.[0-9]+\\.[0-9]+\"" emOutput ${ver}) - string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" build_emcc_version "${emOutput}") - set(${out_var} "${build_emcc_version}" PARENT_SCOPE) endfunction() function(_qt_test_emscripten_version)