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
This commit is contained in:
James Zern 2025-07-07 14:11:24 -07:00
parent 6a3e656b6d
commit f83c6b328f

View File

@ -84,6 +84,15 @@ if(WEBP_BUILD_WEBP_JS)
message(NOTICE message(NOTICE
"wasm2js does not support SIMD, disabling webp.js generation.") "wasm2js does not support SIMD, disabling webp.js generation.")
endif() 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() endif()
set(SHARPYUV_DEP_LIBRARIES) set(SHARPYUV_DEP_LIBRARIES)