# SPDX-License-Identifier: LGPL-2.1-or-later # Keep the preset independent of a distro-specific Emscripten installation # path. Users may provide FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN or EMSCRIPTEN; # otherwise resolve emcc and its real path from PATH. set(FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN "" CACHE FILEPATH "Path to Emscripten.cmake used by the FreeCAD Web preset") if(NOT FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN OR NOT EXISTS "${FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN}") if(DEFINED ENV{EMSCRIPTEN} AND EXISTS "$ENV{EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake") set(FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN "$ENV{EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake" CACHE FILEPATH "Resolved Emscripten toolchain" FORCE) else() find_program(_FREECAD_WEB_EMCC emcc) if(_FREECAD_WEB_EMCC) get_filename_component(_FREECAD_WEB_EMCC_REAL "${_FREECAD_WEB_EMCC}" REALPATH) get_filename_component(_FREECAD_WEB_EMSCRIPTEN_ROOT "${_FREECAD_WEB_EMCC_REAL}" DIRECTORY) if(EXISTS "${_FREECAD_WEB_EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake") set(FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN "${_FREECAD_WEB_EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake" CACHE FILEPATH "Resolved Emscripten toolchain" FORCE) endif() endif() endif() endif() if(NOT EXISTS "${FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN}") message(FATAL_ERROR "Could not locate Emscripten.cmake. Set EMSCRIPTEN or " "FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN to the Emscripten installation root/file.") endif() include("${FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN}")