-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
39 lines (30 loc) · 1.13 KB
/
CMakeLists.txt
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
26
27
28
29
30
31
32
33
34
35
36
37
38
cmake_minimum_required(VERSION 3.11)
include(FetchContent)
project(LuaTest LANGUAGES C CXX)
set(LUA_VERSION "5.4.6")
set(LUA_HASH "SHA256=7d5ea1b9cb6aa0b59ca3dde1c6adcb57ef83a1ba8e5432c0ecd06bf439b3ad88")
FetchContent_Declare(
lua
URL https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
URL_HASH ${LUA_HASH}
)
FetchContent_GetProperties(lua)
if(NOT lua_POPULATED)
FetchContent_Populate(lua)
endif()
set(LUA_SRC ${lua_SOURCE_DIR}/src)
file(GLOB ${PROJECT_NAME}_SRC ${LUA_SRC}/*.c ${LUA_SRC}/*.h *.cpp *.h *.def)
list(REMOVE_ITEM ${PROJECT_NAME}_SRC ${LUA_SRC}/lua.c ${LUA_SRC}/luac.c)
message("SRC: ${${PROJECT_NAME}_SRC}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) #Eg. -std=c++17 instead of -std=gnu++17
# IDE configuration
set_property(GLOBAL PROPERTY USE_FOLDERS ON) #allows the creation of solution folders
if(UNIX)
add_definitions(-DLUA_USE_POSIX)
endif()
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_SRC})
target_compile_definitions(${PROJECT_NAME} PRIVATE BOGUS_HASH_DEF)
target_include_directories(${PROJECT_NAME} PRIVATE ${LUA_SRC})
target_link_libraries(${PROJECT_NAME} ${LIBCXX})