summaryrefslogtreecommitdiff
path: root/libs/luajit-cmake/CMakeLists.txt
blob: ea0c74d3ab4ee47883ab53591026c31966d38ee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
cmake_minimum_required(VERSION 3.0)

# manually configure the luajit dir (added by sanine)
set(LUAJIT_DIR ${CMAKE_CURRENT_LIST_DIR}/luajit)

option(LUA_DIR "Path of Lua 5.4 source dir" OFF)
option(LUAJIT_DIR "Path of LuaJIT 2.1 source dir" OFF)

if(LUAJIT_DIR)
  project(luajit)
  include(LuaJIT.cmake)
  if (PARENT_DIRECTORY)
    set(LUA_TARGET luajit PARENT_SCOPE)
    set(LUA_LIBRARIES libluajit PARENT_SCOPE)
  endif()
elseif(LUA_DIR)
  project(lua)
  include(lua.cmake)
  if (PARENT_DIRECTORY)
    set(LUA_TARGET lua PARENT_SCOPE)
    set(LUA_LIBRARIES liblua PARENT_SCOPE)
  endif()
else()
  message(FATAL_ERROR "Must set LUAJIT_DIR or LUA_DIR to build with CMake")
endif()