forked from tomaka/luawrapper
-
Notifications
You must be signed in to change notification settings - Fork 24
/
CMakeLists.txt
73 lines (61 loc) · 1.82 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
cmake_minimum_required(VERSION 2.8)
project(luawrapper)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
set(CMAKE_GENERATOR_TOOLSET "v120" CACHE STRING "") # building for VC++ 2013
# boost
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
# lua
find_package(Lua51)
find_package(Lua52)
find_package(Lua53)
find_package(LuaJIT51)
if (NOT ${LUA51_FOUND} AND NOT ${LUA52_FOUND} AND NOT ${LUA53_FOUND} AND NOT ${LUAJIT51_FOUND})
message(FATAL_ERROR "Could not find lua library")
endif()
include_directories(${LUA_INCLUDE_DIR})
# including lua wrapper
include_directories(include)
# setting up external project
include(ExternalProject)
# gtest
find_package(Git REQUIRED)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/ThirdParty/googletest-src)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/ThirdParty/googletest-bin)
execute_process(COMMAND ${GIT_EXECUTABLE} clone -b release-1.10.0 https://github.com/google/googletest.git googletest-src WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/ThirdParty)
add_subdirectory(${CMAKE_BINARY_DIR}/ThirdParty/googletest-src ThirdParty/googletest-bin)
include_directories(${CMAKE_BINARY_DIR}/ThirdParty/googletest-src/include)
# flags
if (${CMAKE_COMPILER_IS_GNUCXX})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
# executable
add_executable(tests
tests/main.cpp
tests/basic_readwrite.cpp
tests/advanced_readwrite.cpp
tests/execution.cpp
tests/functions_write.cpp
tests/functions_read.cpp
tests/custom_types.cpp
tests/movable.cpp
tests/metatables.cpp
tests/threads.cpp
tests/maps.cpp
)
target_link_libraries(tests
${LUA_LIBRARIES}
gtest
gtest_main
)
# hack
if (${UNIX})
target_link_libraries(tests
pthread
)
endif()
enable_testing()
add_test(tests tests)