Emscripten: Restore support for emsdk toolchain file and platform module

Emscripten provides a combined toolchain file and platform module that
predates CMake upstream support.  Since commit 96d9b94a98 (Emscripten:
Add platform modules, 2025-05-16), our `Platform/Emscripten` module is
included instead, suppressing existing behavior for users that set
`CMAKE_TOOLCHAIN_FILE` to the emsdk-provided toolchain file.  Restore
the previous behavior by teaching our module to defer to the original
module in that case.

Issue: #27232
This commit is contained in:
Brad King
2025-09-17 19:05:18 -04:00
parent 9cbeb922dd
commit 644ad91e6a

View File

@@ -1,3 +1,12 @@
# Emscripten provides a combined toolchain file and platform module
# that predates CMake upstream support. Avoid interfering with it.
if(CMAKE_SYSTEM_VERSION EQUAL 1)
if(CMAKE_TOOLCHAIN_FILE MATCHES [[/Modules/Platform/Emscripten\.cmake$]])
include("${CMAKE_TOOLCHAIN_FILE}")
return()
endif()
endif()
set(CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH ON)
set(CMAKE_SHARED_LIBRARY_SUFFIX ".wasm")