From f83c6b328f11384aaedb23ea610c570c4a27501a Mon Sep 17 00:00:00 2001 From: James Zern Date: Mon, 7 Jul 2025 14:11:24 -0700 Subject: [PATCH] CMakeLists: add warning for incorrect emscripten config `-DWEBP_BUILD_WEBP_JS=1` requires `emcmake` and `emmake`. Attempt to detect `emcmake` usage by checking for the `EMSCRIPTEN_VERSION` variable and issue a warning if it is not set. This may help avoid a surprising build error as `cmake` itself will succeed: ``` $ make [...] [100%] Building C object CMakeFiles/webp_wasm.dir/extras/webp_to_sdl.c.o clang: error: no such file or directory: 'SDL2::SDL2' ``` Bug: webp:427525168 Change-Id: I4f5fa2ffbbc4123e28172f2b7ef952a1b1a687bf --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2222b36c..39d3d8f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,15 @@ if(WEBP_BUILD_WEBP_JS) message(NOTICE "wasm2js does not support SIMD, disabling webp.js generation.") endif() + + if(NOT EMSCRIPTEN_VERSION) + message( + WARNING + "EMSCRIPTEN_VERSION not detected!\n" + "WEBP_BUILD_WEBP_JS is only supported with emcmake/emmake.\n" + "The build may fail if those tools are not used. See webp_js/README.md." + ) + endif() endif() set(SHARPYUV_DEP_LIBRARIES)