-
Notifications
You must be signed in to change notification settings - Fork 1
/
FindTarantool.cmake
45 lines (40 loc) · 1.79 KB
/
FindTarantool.cmake
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
# Define GNU standard installation directories
include(GNUInstallDirs)
macro(extract_definition name output input)
string(REGEX MATCH "#define[\t ]+${name}[\t ]+\"([^\"]*)\""
_t "${input}")
string(REGEX REPLACE "#define[\t ]+${name}[\t ]+\"(.*)\"" "\\1"
${output} "${_t}")
endmacro()
find_path(TARANTOOL_INCLUDE_DIR tarantool/module.h
HINTS ${TARANTOOL_DIR} ENV TARANTOOL_DIR
PATH_SUFFIXES include
)
if(TARANTOOL_INCLUDE_DIR)
set(_config "-")
file(READ "${TARANTOOL_INCLUDE_DIR}/tarantool/module.h" _config0)
string(REPLACE "\\" "\\\\" _config ${_config0})
unset(_config0)
extract_definition(PACKAGE_VERSION TARANTOOL_VERSION ${_config})
extract_definition(INSTALL_PREFIX _install_prefix ${_config})
unset(_config)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Tarantool
REQUIRED_VARS TARANTOOL_INCLUDE_DIR VERSION_VAR TARANTOOL_VERSION)
if(TARANTOOL_FOUND)
set(TARANTOOL_INCLUDE_DIRS "${TARANTOOL_INCLUDE_DIR}"
"${TARANTOOL_INCLUDE_DIR}/tarantool/"
CACHE PATH "Include directories for Tarantool")
set(TARANTOOL_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/tarantool"
CACHE PATH "Directory for storing Lua modules written in Lua")
set(TARANTOOL_INSTALL_LUADIR "${CMAKE_INSTALL_DATADIR}/tarantool"
CACHE PATH "Directory for storing Lua modules written in C")
if (NOT TARANTOOL_FIND_QUIETLY AND NOT FIND_TARANTOOL_DETAILS)
set(FIND_TARANTOOL_DETAILS ON CACHE INTERNAL "Details about TARANTOOL")
message(STATUS "Tarantool LUADIR is ${TARANTOOL_INSTALL_LUADIR}")
message(STATUS "Tarantool LIBDIR is ${TARANTOOL_INSTALL_LIBDIR}")
endif ()
endif()
mark_as_advanced(TARANTOOL_INCLUDE_DIRS TARANTOOL_INSTALL_LIBDIR
TARANTOOL_INSTALL_LUADIR)