Merge pull request #10 from dedmen/master

Added ability to compile lua as C++
This commit is contained in:
Walter Schell 2021-04-26 11:47:19 -04:00 committed by GitHub
commit 6ed3e61e93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.1)
project(lua LANGUAGES C VERSION 5.4.2)
option(LUA_SUPPORT_DL "Support dynamic loading of compiled modules" OFF)
option(LUA_BUILD_AS_CXX "Build lua as C++" OFF)
enable_language(CXX)
if(${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
set(TOP_LEVEL TRUE)

View File

@ -33,6 +33,10 @@ set(LUA_LIB_SRCS
"src/linit.c"
)
if(LUA_BUILD_AS_CXX)
set_source_files_properties(${LUA_LIB_SRCS} "src/lua.c" "src/luac.c" PROPERTIES LANGUAGE CXX )
endif()
add_library(lua_static STATIC ${LUA_LIB_SRCS})
set_target_properties(lua_static PROPERTIES OUTPUT_NAME "lua")
target_include_directories(lua_static PUBLIC "include")