CMake: Only require finding Lua libs via find_package on Windows
Introduced in fixes
@@ -104,11 +104,29 @@ if (LUA)
else (LUA)
if (LUA_BUILD_TYPE STREQUAL System)
if (USE_LUAJIT)
+ # We only link the libs on Windows, so find_package fully succeeding
+ # is only required on Windows
+ if (WIN32)
find_package(LuaJIT REQUIRED)
- include_directories(${LUAJIT_INCLUDE_DIR})
link_directories(${LUAJIT_LIBRARIES})
+ else()
+ find_package(LuaJIT)
+ endif()
+ if(NOT LUAJIT_INCLUDE_DIR)
+ message( FATAL_ERROR "Failed to find LuaJIT headers. Variable `LUAJIT_INCLUDE_DIR' expected to be defined.")
+ endif()
+ include_directories(${LUAJIT_INCLUDE_DIR})
else (USE_LUAJIT)
+ # We only link the libs on Windows, so find_package fully succeeding
+ # is only required on Windows
+ if (WIN32)
find_package(Lua REQUIRED)
+ else()
+ find_package(Lua)
+ endif()
+ if(NOT LUA_INCLUDE_DIR)
+ message( FATAL_ERROR "Failed to find Lua headers. Variable `LUA_INCLUDE_DIR' expected to be defined.")
+ endif()
include_directories(${LUA_INCLUDE_DIR})
endif (USE_LUAJIT)
