diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake index b6774eb4452..63a2d8492ab 100644 --- a/cmake/luajit.cmake +++ b/cmake/luajit.cmake @@ -1,4 +1,5 @@ # luajit cmake option(LUAJIT_DIR "Path of LuaJIT 2.1 source dir" ON) +option(LUAJIT_SETUP_INCLUDE_DIR "Setup include dir if parent is present" OFF) set(LUAJIT_DIR ${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_LUAJIT}) add_subdirectory("lib/luajit-cmake") diff --git a/lib/luajit-cmake/CMakeLists.txt b/lib/luajit-cmake/CMakeLists.txt index 86747f28212..7baf878c775 100644 --- a/lib/luajit-cmake/CMakeLists.txt +++ b/lib/luajit-cmake/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5) option(LUA_DIR "Path of Lua 5.4 source dir" OFF) option(LUAJIT_DIR "Path of LuaJIT 2.1 source dir" OFF) +option(LUAJIT_SETUP_INCLUDE_DIR "Setup include dir if parent is present" ON) if(CMAKE_COMPILER_IS_GNUCC) set(LUA_TARGET_SHARED ON) @@ -17,8 +18,10 @@ if(LUAJIT_DIR) if (hasParent) set(LUA_TARGET $ PARENT_SCOPE) set(LUA_LIBRARIES luajit::lib PARENT_SCOPE) - get_target_property(LUA_INCLUDE_DIR luajit::header INCLUDE_DIRECTORIES) - set(LUA_INCLUDE_DIR ${LUA_INCLUDE_DIR} PARENT_SCOPE) + if (LUAJIT_SETUP_INCLUDE_DIR) + get_target_property(LUA_INCLUDE_DIR luajit::header INCLUDE_DIRECTORIES) + set(LUA_INCLUDE_DIR ${LUA_INCLUDE_DIR} PARENT_SCOPE) + endif() endif() elseif(LUA_DIR) project(lua) @@ -26,8 +29,10 @@ elseif(LUA_DIR) if (hasParent) set(LUA_TARGET $ PARENT_SCOPE) set(LUA_LIBRARIES lua::lib PARENT_SCOPE) - get_target_property(LUA_INCLUDE_DIR lua::header INCLUDE_DIRECTORIES) - set(LUA_INCLUDE_DIR ${LUA_INCLUDE_DIR} PARENT_SCOPE) + if (LUAJIT_SETUP_INCLUDE_DIR) + get_target_property(LUA_INCLUDE_DIR lua::header INCLUDE_DIRECTORIES) + set(LUA_INCLUDE_DIR ${LUA_INCLUDE_DIR} PARENT_SCOPE) + endif() endif() if (WITH_LIBFFI) include(ffi.cmake)