-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
66 lines (49 loc) · 1.78 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
PROJECT(axe C)
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules")
# Cmake options
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
ENABLE_TESTING()
IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF()
IF (NOT AXE_VERSION)
# git describe as versioning
EXECUTE_PROCESS(COMMAND git describe
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE AXE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF()
MESSAGE(STATUS "${CMAKE_BUILD_TYPE} build of axe version: ${AXE_VERSION}")
###############################
## Find Packages and Headers ##
###############################
FIND_PACKAGE(ZLIB 1.2.5 REQUIRED)
FIND_PACKAGE(GSL)
IF (GSL_FOUND)
SET(AXE_DEP_INCLUDES ${GSL_INCLUDE_DIRS})
SET(AXE_DEP_LIBS ${GSL_LIBRARIES})
ENDIF()
##########################
## Set Compiler Options ##
##########################
# Set CFLAGS
SET(AXEWRN "${AXEWRN} -fstack-protector-all -Wstack-protector")
SET(AXEWRN "${AXEWRN} -Wall -Wextra -Wpedantic")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${AXEWRN}")
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/datrie
${PROJECT_SOURCE_DIR}/src/libqes/src
${PROJECT_SOURCE_DIR}/src/gsl)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/src/axe_config.h.in
${CMAKE_BINARY_DIR}/axe_config.h)
SET(LIBQES_AS_SUBMODULE True) # stop libqes installing itself
ADD_SUBDIRECTORY(src/libqes)
ADD_SUBDIRECTORY(docs)
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(src)