summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorDavid Skoland <david.skoland@qt.io>2022-09-08 07:32:38 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-13 16:13:12 +0000
commitbf00ecb41b742ea9830a6cf20a5046f361cd4061 (patch)
treeece2be2f434308794dcf4f9a71a27cd8c5cd9da6 /cmake
parentf213f58889354c1ba0f60c9f210034a7ca1f5a89 (diff)
wasm: Replace QT6_INSTALL_PREFIX with WASM_BUILD_DIR in cmake helper
The change b515fa56a3144289023dc9588c5f73283599e4d4 introduced checking the emsdk version of a qt installation. However, this checked for QT6_INSTALL_PREFIX where it may not be defined. This fails when trying to build tests because when configuring tests, it calls into add_target_helpers which calls into this logic, and QT6_INSTALL_PREFIX is set after this is called into, causing the qconfig.h lookup to fail. To fix this so it works in all conditions, we need to check if either install prefix or build_dir is set and use whichever is set. Change-Id: I3cf7e20d3d830f04e5b632fc51d8bf3b2758a717 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 3bd54f285dd41f4c176ed54161b58ab5c85e14c3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtPublicWasmToolchainHelpers.cmake11
1 files changed, 8 insertions, 3 deletions
diff --git a/cmake/QtPublicWasmToolchainHelpers.cmake b/cmake/QtPublicWasmToolchainHelpers.cmake
index 759c82e36c..2e8e34f1a3 100644
--- a/cmake/QtPublicWasmToolchainHelpers.cmake
+++ b/cmake/QtPublicWasmToolchainHelpers.cmake
@@ -71,10 +71,15 @@ function(__qt_internal_show_error_no_emscripten_toolchain_file_found_when_using_
endfunction()
function(__qt_internal_get_qt_build_emsdk_version out_var)
- if(EXISTS "${QT6_INSTALL_PREFIX}/src/corelib/global/qconfig.h")
- file(READ "${QT6_INSTALL_PREFIX}/src/corelib/global/qconfig.h" ver)
+ if(QT6_INSTALL_PREFIX)
+ set(WASM_BUILD_DIR "${QT6_INSTALL_PREFIX}")
+ elseif(QT_BUILD_DIR)
+ set(WASM_BUILD_DIR "${QT_BUILD_DIR}")
+ endif()
+ if(EXISTS "${WASM_BUILD_DIR}/src/corelib/global/qconfig.h")
+ file(READ "${WASM_BUILD_DIR}/src/corelib/global/qconfig.h" ver)
else()
- file(READ "${QT6_INSTALL_PREFIX}/include/QtCore/qconfig.h" ver)
+ file(READ "${WASM_BUILD_DIR}/include/QtCore/qconfig.h" ver)
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}")