aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnan Ajmain <3nan.ajmain@gmail.com>2023-05-07 04:47:45 +0600
committerGitHub <noreply@github.com>2023-05-07 00:47:45 +0200
commit1bf29a0ae1fffee8a009dfbc8da2d7c048f6eb20 (patch)
tree8db0f753d8a735341464b180863892188c313f52
parent9248dd77ac58bd23721dc4e156e43ed5e9ada338 (diff)
downloadrneovim-1bf29a0ae1fffee8a009dfbc8da2d7c048f6eb20.tar.gz
rneovim-1bf29a0ae1fffee8a009dfbc8da2d7c048f6eb20.tar.bz2
rneovim-1bf29a0ae1fffee8a009dfbc8da2d7c048f6eb20.zip
build: add system lua include dir for lpeg
Problem: Lpeg requires Lua headers. Currently the include directories for Lpeg are set only to the bundled deps folder, so if the user wants to use system Lua/Luajit, Lpeg will not find the system headers and will fail to build. Solution: Add system Lua/Luajit include directories when USE_BUNDLED_LUA and USE_BUNDLED_LUAJIT are turned off. Fixes #23469
-rw-r--r--cmake.deps/cmake/BuildLpeg.cmake16
1 files changed, 15 insertions, 1 deletions
diff --git a/cmake.deps/cmake/BuildLpeg.cmake b/cmake.deps/cmake/BuildLpeg.cmake
index 81efccf1f4..bbdc83d94d 100644
--- a/cmake.deps/cmake/BuildLpeg.cmake
+++ b/cmake.deps/cmake/BuildLpeg.cmake
@@ -1,4 +1,18 @@
-list(APPEND LPEG_CMAKE_ARGS "-DCMAKE_C_FLAGS:STRING=${DEPS_INCLUDE_FLAGS}")
+set(LPEG_INCLUDE_FLAGS ${DEPS_INCLUDE_FLAGS})
+
+if(NOT USE_BUNDLED_LUAJIT AND NOT USE_BUNDLED_LUA)
+ find_package(Luajit)
+ if(LUAJIT_FOUND)
+ string(CONCAT LPEG_INCLUDE_FLAGS ${DEPS_INCLUDE_FLAGS} " -I${LUAJIT_INCLUDE_DIR}")
+ else()
+ find_package(Lua 5.1 EXACT)
+ if(LUA_FOUND)
+ string(CONCAT LPEG_INCLUDE_FLAGS ${DEPS_INCLUDE_FLAGS} " -I${LUA_INCLUDE_DIR}")
+ endif()
+ endif()
+endif()
+
+list(APPEND LPEG_CMAKE_ARGS -DCMAKE_C_FLAGS=${LPEG_INCLUDE_FLAGS})
ExternalProject_Add(lpeg
URL ${LPEG_URL}