From 29a43ef8affbb9ecbae03b75db346205ffe9ec14 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 10 Mar 2023 22:40:41 +0100 Subject: [PATCH] build: explicitly add dependency include dir for header generation Neovim and the generated headers needs to use the same include directories to build correctly. However, we need to generate headers before all target dependencies has been resolved, meaning that we cannot rely on any target to determine the final list of include directories. This may lead to a problems when bundling some, but not all or none, dependencies as the dependency include directory won't be included. Also remove the dependency path options as this assumes a specific structure on the dependency build directory. --- cmake.deps/CMakeLists.txt | 10 +++++----- src/nvim/CMakeLists.txt | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt index 42f97a5c2b..0d3e3886f5 100644 --- a/cmake.deps/CMakeLists.txt +++ b/cmake.deps/CMakeLists.txt @@ -34,11 +34,11 @@ if(HAS_OG_FLAG) set(DEFAULT_MAKE_CFLAGS CFLAGS+=-Og ${DEFAULT_MAKE_CFLAGS}) endif() -set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr" CACHE PATH "Dependencies install directory.") -set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin" CACHE PATH "Dependencies binary install directory.") -set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib" CACHE PATH "Dependencies library install directory.") -set(DEPS_BUILD_DIR "${CMAKE_BINARY_DIR}/build" CACHE PATH "Dependencies build directory.") -set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads" CACHE PATH "Dependencies download directory.") +set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr") +set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin") +set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib") +set(DEPS_BUILD_DIR "${CMAKE_BINARY_DIR}/build") +set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads") list(APPEND DEPS_CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}) diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index b02c740471..edd0b178d4 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -393,6 +393,7 @@ get_target_property(prop main_lib INTERFACE_INCLUDE_DIRECTORIES) foreach(gen_include ${prop}) list(APPEND gen_cflags "-I${gen_include}") endforeach() +list(APPEND gen_cflags "-I${DEPS_PREFIX}/include") if(APPLE AND CMAKE_OSX_SYSROOT) list(APPEND gen_cflags "-isysroot") list(APPEND gen_cflags "${CMAKE_OSX_SYSROOT}")