diff --git a/cmake/QtWasmHelpers.cmake b/cmake/QtWasmHelpers.cmake index 3ce1e3f126b..20bd5b333d6 100644 --- a/cmake/QtWasmHelpers.cmake +++ b/cmake/QtWasmHelpers.cmake @@ -34,6 +34,13 @@ function (qt_internal_setup_wasm_target_properties wasmTarget) target_link_options("${wasmTarget}" INTERFACE -fexceptions) endif() + # setjmp/longjmp type. The type is "emscripten" by default, but must + # be set to "wasm" when wasm-exceptions are used, for compatibility reasons. + if (QT_FEATURE_wasm_exceptions) + target_compile_options("${wasmTarget}" INTERFACE -s SUPPORT_LONGJMP=wasm) + target_link_options("${wasmTarget}" INTERFACE -s SUPPORT_LONGJMP=wasm) + endif() + if (QT_FEATURE_thread) target_compile_options("${wasmTarget}" INTERFACE "SHELL:-pthread") target_link_options("${wasmTarget}" INTERFACE "SHELL:-pthread")