mirror of
https://github.com/walterschell/Lua.git
synced 2024-09-19 13:22:16 +00:00
6f99e2d952
- build shared and/or static version controlled by `LUA_ENABLE_SHARED/STATIC` - add alias Lua::Lib which is one of above, controlled by `BUILD_SHARED_LIBS` - exclude the unneeded version if not toplevel
30 lines
868 B
CMake
30 lines
868 B
CMake
cmake_minimum_required(VERSION 3.1)
|
|
project(lua LANGUAGES C VERSION 5.4.4)
|
|
|
|
option(LUA_SUPPORT_DL "Support dynamic loading of compiled modules" OFF)
|
|
option(LUA_BUILD_AS_CXX "Build lua as C++" OFF)
|
|
option(LUA_ENABLE_SHARED "Build dynamic liblua" ON)
|
|
option(LUA_ENABLE_STATIC "Build static liblua" ON)
|
|
enable_language(CXX)
|
|
|
|
if(NOT LUA_ENABLE_SHARED AND NOT LUA_ENABLE_STATIC)
|
|
message(FATAL_ERROR "You must enable at least one of static or dynamic version of liblua")
|
|
endif()
|
|
|
|
if(${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
|
set(TOP_LEVEL TRUE)
|
|
else()
|
|
set(TOP_LEVEL FALSE)
|
|
endif()
|
|
|
|
if(TOP_LEVEL)
|
|
option(LUA_BUILD_BINARY "Build lua binary" ON)
|
|
option(LUA_BUILD_COMPILER "Build luac compiler" ON)
|
|
else()
|
|
option(LUA_BUILD_BINARY "Build lua binary" OFF)
|
|
option(LUA_BUILD_COMPILER "Build luac compiler" ON)
|
|
endif()
|
|
|
|
|
|
add_subdirectory(lua-5.4.4)
|