-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
39 lines (27 loc) · 1.11 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
39
cmake_minimum_required(VERSION 3.10)
#list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
project(lua-interpreter-demo)
# libraries
find_package(Lua 5.3 REQUIRED)
include_directories(${LUA_INCLUDE_DIR})
message("lua Found: ${LUA_VERSION_STRING} inc: ${LUA_INCLUDE_DIR} lib: ${LUA_LIBRARIES}")
# compiler flags
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
# cmake
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/lib)
set(CMAKE_VERBOSE_MAKEFILE ON)
# lib
add_library(lua_interpreter STATIC lua_interpreter.cxx)
set_target_properties(lua_interpreter PROPERTIES PUBLIC_HEADER lua_interpreter.hxx)
target_link_libraries(lua_interpreter ${LUA_LIBRARIES})
# demo exec
add_executable(demo_repl demo_repl.cxx)
target_link_libraries(demo_repl lua_interpreter)
enable_testing()
add_executable(demo_test demo_test.cxx)
target_link_libraries(demo_test lua_interpreter)
add_test(demo_test ${CMAKE_BINARY_DIR}/build/bin/demo_test)