commit 0ddba68607a91c2397a8122da610331e2335e40f
parent 9278f792c374e32de4906dc23adfc9144812c285
Author: Rawan Muhammad <145160003+Rawan10101@users.noreply.github.com>
Date: Tue, 3 Feb 2026 20:26:55 +0200
build: ensure toolchain is passed to bundled deps #37587
Problem:
When building Neovim with Emscripten for WebAssembly, the
`CMAKE_TOOLCHAIN_FILE` is not propagated to dependency builds.
So libuv attempts to include Linux-specific headers like
`sys/epoll.h` which don't exist in the WebAssembly environment.
From #37572:
…/NeovimWeb/external/neovim/.deps/build/src/libuv/src/unix/linux.c:44:10:
fatal error: 'sys/epoll.h' file not found
44 | #include <sys/epoll.h> | ^~~~~~~~~~~~~
Solution:
1. Add initialization for DEPS_CMAKE_ARGS to prevent CMake errors.
2. Implement conditional logic to always pass CMAKE_TOOLCHAIN_FILE to
dependencies.
This allows dependencies like libuv to detect they're building for
WebAssembly and disable incompatible Linux specific features such as
epoll which resolves the sys/epoll.h error.
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt
@@ -62,6 +62,11 @@ option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing s
set_default_buildtype(Release)
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+
+if (NOT DEFINED DEPS_CMAKE_ARGS)
+ set(DEPS_CMAKE_ARGS)
+endif()
+
if(NOT isMultiConfig)
list(APPEND DEPS_CMAKE_ARGS -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
@@ -73,6 +78,13 @@ if(HAS_OG_FLAG)
set(DEFAULT_MAKE_CFLAGS CFLAGS+=-Og ${DEFAULT_MAKE_CFLAGS})
endif()
+# Always pass the toolchain if it exists
+if(CMAKE_TOOLCHAIN_FILE)
+ list(APPEND DEPS_CMAKE_ARGS
+ -D CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
+ )
+endif()
+
set(DEPS_INCLUDE_FLAGS "-I\"${DEPS_INSTALL_DIR}/include\" -I\"${DEPS_INSTALL_DIR}/include/luajit-2.1\"")
# If the macOS deployment target is not set manually (via $MACOSX_DEPLOYMENT_TARGET),