-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
55 lines (42 loc) · 1.73 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
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
include(ExternalProject)
find_program(GIT git)
project(mysql C)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
# Find Tarantool
set(TARANTOOL_FIND_REQUIRED ON)
find_package(Tarantool)
# Get git version only if source directory has .git repository, this
# avoids git to search .git repository in parent
# directories.
#
if (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT)
execute_process (COMMAND ${GIT} describe --long HEAD
OUTPUT_VARIABLE TARANTOOL_MYSQL_GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
if (NOT ("${TARANTOOL_MYSQL_GIT_VERSION}" STREQUAL "${TARANTOOL_MYSQL_VERSION}"))
set(TARANTOOL_MYSQL_VERSION "${TARANTOOL_MYSQL_GIT_VERSION}")
message(STATUS "Generating VERSION file")
file(WRITE ${VERSION_FILE} "${TARANTOOL_MYSQL_VERSION}\n")
message(STATUS "Updating submodules")
execute_process(COMMAND ${GIT} submodule update --init --recursive)
endif()
endif()
add_subdirectory(mariadb-connector-c EXCLUDE_FROM_ALL)
include_directories("${CMAKE_SOURCE_DIR}/mariadb-connector-c/include" "${CMAKE_BINARY_DIR}/mariadb-connector-c/include")
include_directories(${TARANTOOL_INCLUDE_DIRS})
# Set CFLAGS
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wextra")
if (APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined suppress -flat_namespace")
endif(APPLE)
# Build module
add_subdirectory(mysql)
add_custom_target(check
COMMAND ${PROJECT_SOURCE_DIR}/test/mysql.test.lua
COMMAND ${PROJECT_SOURCE_DIR}/test/numeric_result.test.lua)