wasm: handle unable to determine emcc versiopn

It can happen that we are not able to determine which
Emscripten version Qt is built with, for example if
the detection code runs at a time when qconfig.h has
not been created yet.

In that case skip printing a warning since we are not
able to offer a sensible recommendation.

This fixes Qt configure when building for shared libraries,
where we would previously print this warning several
times:

  Qt Wasm built with Emscripten version:
  You are using Emscripten version: 3.1.50
  The recommended version of Emscripten for this Qt is: 3.1.50
  This may not work correctly

Change-Id: Ie15300e89c0e4b6f22650e662dd30fd32828e60c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Morten Sørvig 2024-03-21 21:58:30 +01:00
parent a246286c46
commit b8bcf6b883

View File

@ -83,8 +83,6 @@ function(__qt_internal_get_qt_build_emsdk_version out_var)
file(READ "${WASM_BUILD_DIR}/src/corelib/global/qconfig.h" ver)
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})
@ -99,7 +97,7 @@ function(_qt_test_emscripten_version)
__qt_internal_query_emsdk_version("${emroot_path}" TRUE current_emsdk_ver)
__qt_internal_get_qt_build_emsdk_version(qt_build_emcc_version)
if(NOT "${qt_build_emcc_version}" STREQUAL "${current_emsdk_ver}")
if(NOT "${qt_build_emcc_version}" STREQUAL "" AND NOT "${qt_build_emcc_version}" STREQUAL "${current_emsdk_ver}")
message("Qt Wasm built with Emscripten version: ${qt_build_emcc_version}")
message("You are using Emscripten version: ${current_emsdk_ver}")
message("The recommended version of Emscripten for this Qt is: ${_recommended_emver}")