forked from tarantool/cartridge-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (53 loc) · 1.81 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
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(cartridge-cli C)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# Find Tarantool and Lua dependecies
set(TARANTOOL_FIND_REQUIRED ON)
find_package(Tarantool)
enable_testing()
set (LUA_PATH "LUA_PATH=${PROJECT_SOURCE_DIR}/?.lua\\;${PROJECT_SOURCE_DIR}/?/init.lua\\;\\;")
set (LUA_SOURCE_DIR "LUA_SOURCE_DIR=${PROJECT_SOURCE_DIR}")
## VERSION ####################################################################
###############################################################################
if (NOT VERSION)
execute_process(
COMMAND git describe --tags --always
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE VERSION
ERROR_QUIET
)
endif()
if (VERSION)
configure_file (
"${PROJECT_SOURCE_DIR}/${PROJECT_NAME}/VERSION.lua.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/VERSION.lua"
)
elseif(NOT LUAROCKS) # allow luarocks to build without passing VERSION
message(FATAL_ERROR "VERSION is not provided")
endif()
## Install ####################################################################
###############################################################################
install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/cartridge-cli.lua
DESTINATION ${TARANTOOL_INSTALL_LUADIR}/
)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/templates
${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}
USE_SOURCE_PERMISSIONS
DESTINATION ${TARANTOOL_INSTALL_LUADIR}/
PATTERN "*.in" EXCLUDE
)
install(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
DESTINATION ${TARANTOOL_INSTALL_LUADIR}/
OPTIONAL
)
install(
PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/cartridge
DESTINATION ${TARANTOOL_INSTALL_BINDIR}
)