-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
74 lines (55 loc) · 2.14 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
74
cmake_minimum_required(VERSION 2.8.6)
enable_testing()
# Enable folder grouping of projects in IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if (NOT CMAKE_BUILD_TYPE)
message(WARNING "No build type selected, defaulting to Debug")
set(CMAKE_BUILD_TYPE "Debug")
endif()
project(icli)
if (INCLUDE_PATH)
include_directories(BEFORE ${INCLUDE_PATH})
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -std=c99")
set(warning_flags "-Wall \
-Wsign-compare \
-Wclobbered \
-Wempty-body \
-Wignored-qualifiers \
-Wsign-compare \
-Wtype-limits \
-Wunused-but-set-parameter \
-Wconversion \
-Winit-self \
-Wno-unused-function")
set(CMAKE_C_FLAGS_DEBUG "${warning_flags} \
-O0 \
-ggdb \
-D_FORTIFY_SOURCE=2")
set(CMAKE_C_FLAGS_RELEASE "${warning_flags} \
-O2 \
-DNDEBUG \
-ggdb \
-U_FORTIFY_SOURCE")
set(target icli)
add_library(${target} STATIC icli.c)
target_include_directories(${target} PUBLIC .)
set(target cli)
add_executable(${target} EXCLUDE_FROM_ALL examples/cli.c)
target_include_directories(${target} PUBLIC .)
target_link_libraries(${target}
icli
edit
)
add_test("integ_test" ${CMAKE_SOURCE_DIR}/test/test.sh)
SET_TESTS_PROPERTIES("integ_test"
PROPERTIES ENVIRONMENT "SRC_DIR=${CMAKE_SOURCE_DIR};BUILD_DIR=${CMAKE_BINARY_DIR}")
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)