2016-09-22 13:39:06 +00:00
|
|
|
cmake_minimum_required(VERSION 3.1)
|
2024-09-11 13:07:54 +00:00
|
|
|
project(lua LANGUAGES C VERSION 5.4.7)
|
2020-06-30 12:52:34 +00:00
|
|
|
|
2020-06-30 13:29:24 +00:00
|
|
|
option(LUA_SUPPORT_DL "Support dynamic loading of compiled modules" OFF)
|
2021-04-25 18:39:29 +00:00
|
|
|
option(LUA_BUILD_AS_CXX "Build lua as C++" OFF)
|
2022-04-29 13:23:19 +00:00
|
|
|
option(LUA_ENABLE_SHARED "Build dynamic liblua" ON)
|
2022-10-16 19:41:36 +00:00
|
|
|
option(LUA_ENABLE_TESTING "Build and run tests" ON)
|
|
|
|
|
2021-04-26 15:02:07 +00:00
|
|
|
enable_language(CXX)
|
2022-10-16 19:41:36 +00:00
|
|
|
if(LUA_ENABLE_TESTING)
|
|
|
|
enable_testing()
|
|
|
|
endif()
|
2020-06-30 13:29:24 +00:00
|
|
|
|
2020-06-30 12:52:34 +00:00
|
|
|
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()
|
|
|
|
|
2023-08-08 03:22:22 +00:00
|
|
|
add_subdirectory(lua-${PROJECT_VERSION})
|
2022-05-13 00:34:05 +00:00
|
|
|
|
2022-10-16 19:41:36 +00:00
|
|
|
if(LUA_ENABLE_TESTING)
|
2023-07-11 11:21:55 +00:00
|
|
|
add_test(NAME lua-testsuite COMMAND lua -e "_U=true" all.lua WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lua-${CMAKE_PROJECT_VERSION}-tests)
|
2022-10-16 19:41:36 +00:00
|
|
|
endif()
|