forked from OLSR/OONF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
111 lines (91 loc) · 3.95 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
project (OONF C)
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
########################################################
#### Set a default build type if none was specified ####
########################################################
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
###########################
#### API configuration ####
###########################
# set cached variables
include (./cmake/lib_config.cmake)
# include compiler flags
include (./cmake/cc_flags.cmake)
########################################
#### get repository tag and version ####
########################################
include (cmake/get_version.cmake)
IF(EXISTS "${PROJECT_BINARY_DIR}/version.cmake")
include (${PROJECT_BINARY_DIR}/version.cmake)
ENDIF()
########################
#### Doxygen target ####
########################
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/files/framework.doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/framework.doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/framework.doxyfile
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
#############################
#### add tarball targets ####
#############################
ADD_CUSTOM_TARGET(targz COMMAND ${CMAKE_COMMAND}
-D SOURCE:STRING=${CMAKE_SOURCE_DIR}
-D BINARY:STRING=${PROJECT_BINARY_DIR}
-D VERSION:STRING=${VERSION}
-D FORMAT:STRING=tar.gz
-D TARBALL:STRING=${TARBALL}
-D TARPREFIX:STRING=${TARPREFIX}
-P ${CMAKE_SOURCE_DIR}/cmake/generate_archive.cmake)
ADD_CUSTOM_TARGET(tarbz2 COMMAND ${CMAKE_COMMAND}
-D SOURCE:STRING=${CMAKE_SOURCE_DIR}
-D BINARY:STRING=${PROJECT_BINARY_DIR}
-D VERSION:STRING=${VERSION}
-D FORMAT:STRING=tar.bz2
-D TARBALL:STRING=${TARBALL}
-D TARPREFIX:STRING=${TARPREFIX}
-P ${CMAKE_SOURCE_DIR}/cmake/generate_archive.cmake)
ADD_CUSTOM_TARGET(zip COMMAND ${CMAKE_COMMAND}
-D SOURCE:STRING=${CMAKE_SOURCE_DIR}
-D BINARY:STRING=${PROJECT_BINARY_DIR}
-D VERSION:STRING=${VERSION}
-D FORMAT:STRING=zip
-D TARBALL:STRING=${TARBALL}
-D TARPREFIX:STRING=${TARPREFIX}
-P ${CMAKE_SOURCE_DIR}/cmake/generate_archive.cmake)
#########################
#### Compile targets ####
#########################
# add define for length of base path
string(LENGTH "${CMAKE_SOURCE_DIR}/" BASELENGTH)
add_definitions(-DBASEPATH_LENGTH=${BASELENGTH})
# include build helper
include (cmake/declare_library.cmake)
# include files
include_directories(${PROJECT_BINARY_DIR})
include_directories(src-api)
if (NOT OONF_NO_TESTING)
ENABLE_TESTING()
endif (NOT OONF_NO_TESTING)
# define static and dynamic target
add_custom_target(static)
add_custom_target(dynamic)
# start compiling core and plugins
add_subdirectory(src-api)
add_subdirectory(src-plugins)
# add_subdirectory(examples)
add_subdirectory(src)
if (NOT OONF_NO_TESTING)
add_subdirectory(tests)
endif (NOT OONF_NO_TESTING)