2019-05-25 14:14:31 +02:00
|
|
|
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
|
|
|
|
|
2019-10-10 20:13:10 +02:00
|
|
|
project(CPMSol2Example)
|
|
|
|
|
|
2019-05-25 14:14:31 +02:00
|
|
|
# ---- Dependencies ----
|
|
|
|
|
|
|
|
|
|
include(../../cmake/CPM.cmake)
|
|
|
|
|
|
|
|
|
|
CPMAddPackage(
|
|
|
|
|
NAME lua
|
|
|
|
|
GIT_REPOSITORY https://github.com/lua/lua.git
|
2019-07-24 11:48:50 +02:00
|
|
|
VERSION 5.3.5
|
2019-05-25 14:14:31 +02:00
|
|
|
DOWNLOAD_ONLY YES
|
|
|
|
|
)
|
|
|
|
|
|
2021-01-06 14:40:33 +01:00
|
|
|
if(lua_ADDED)
|
2019-05-25 14:14:31 +02:00
|
|
|
# lua has no CMakeLists, so we create our own target
|
2021-01-06 14:40:33 +01:00
|
|
|
file(GLOB lua_sources ${lua_SOURCE_DIR}/*.c)
|
2020-09-13 03:00:19 -07:00
|
|
|
list(REMOVE_ITEM lua_sources "${lua_SOURCE_DIR}/lua.c" "${lua_SOURCE_DIR}/luac.c")
|
2019-05-25 14:14:31 +02:00
|
|
|
add_library(lua STATIC ${lua_sources})
|
2021-02-07 17:08:04 +01:00
|
|
|
target_include_directories(lua SYSTEM PUBLIC $<BUILD_INTERFACE:${lua_SOURCE_DIR}>)
|
2019-05-25 14:14:31 +02:00
|
|
|
endif()
|
|
|
|
|
|
2023-01-10 15:31:57 +01:00
|
|
|
CPMAddPackage("gh:ThePhD/sol2@3.3.0")
|
2019-05-25 14:14:31 +02:00
|
|
|
|
|
|
|
|
# ---- Executable ----
|
|
|
|
|
|
2021-02-07 17:08:04 +01:00
|
|
|
add_executable(CPMSol2Example main.cpp)
|
|
|
|
|
target_compile_features(CPMSol2Example PRIVATE cxx_std_17)
|
2023-01-10 15:31:57 +01:00
|
|
|
target_link_libraries(CPMSol2Example sol2 lua)
|