-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
120 lines (84 loc) · 2.65 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
112
113
114
115
116
117
118
119
project(fredcpp)
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
## cmake includes
##
set(CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake"
"${CMAKE_SOURCE_DIR}/cmake/Modules"
${CMAKE_SOURCE_DIR}
)
## facility version
##
include(DefineFacilityVersion)
## application
##
set(APPLICATION_NAME ${${PROJECT_NAME}_FACILITY})
set(APPLICATION_BRIEF ${${PROJECT_NAME}_BRIEF})
set(APPLICATION_VERSION_MAJOR ${${APPLICATION_NAME}_VERSION_MAJOR})
set(APPLICATION_VERSION_MINOR ${${APPLICATION_NAME}_VERSION_MINOR})
set(APPLICATION_VERSION_PATCH ${${APPLICATION_NAME}_VERSION_PATCH})
set(APPLICATION_VERSION ${${APPLICATION_NAME}_VERSION_STRING})
set(LIBRARY_VERSION APPLICATION_VERSION)
set(LIBRARY_SOVERSION APPLICATION_VERSION_MAJOR)
## definitions
##
include(DefineCMakeDefaults)
include(DefinePlatform)
include(DefineCompilerFlags)
include(DefineInstallationPaths)
include(WithOptions)
include(ConfigureChecks)
## disallow in-source build
##
include(MacroEnsureOutOfSourceBuild)
macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out-of-source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.")
## check external dependencies
##
if (WITH_CURL)
find_package(CURL REQUIRED)
endif (WITH_CURL)
## components
##
add_subdirectory(third_party)
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(doc)
## tests
##
## enable_testing() on the top-level to enable make test target
## OR include CTest for full-blown test support
##
if (WITH_TESTS)
include(DefineApiKey)
include(DefineCACertFile)
enable_testing()
#include(CTest)
add_subdirectory(tests)
endif (WITH_TESTS)
## examples
##
if (WITH_EXAMPLES)
add_subdirectory(examples)
endif (WITH_EXAMPLES)
## Add uninstall target
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/CMakeUninstall.cmake
)
## report
message("---------------------------------------------")
message("BUILD:${APPLICATION_NAME}-${APPLICATION_VERSION} ${CMAKE_BUILD_TYPE}")
message("Http-client:${FREDCPP_BUILD_HTTP_CLIENT}")
message(" CURL:${WITH_CURL}")
message("Xml-parser:${FREDCPP_BUILD_XML_PARSER}")
message(" pugixml:${WITH_PUGIXML}")
message("Logger:${FREDCPP_BUILD_LOGGER}")
message(" SimpleLogger:${WITH_SIMPLELOGGER}")
message("Testing:${WITH_TESTS}")
if (WITH_TESTS)
message(" gtest-at options:'${FREDCPP_GTEST_AT_OPTIONS}'")
message(" gtest-ut options:'${FREDCPP_GTEST_UT_OPTIONS}'")
message(" FRED API key file:'${FREDCPP_API_KEY_FILE}'")
message(" FRED CACert file:'${FREDCPP_CACERT_FILE}'")
endif (WITH_TESTS)
message("Examples:${WITH_EXAMPLES}")
message("---------------------------------------------")