forked from Snaipe/Criterion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
111 lines (85 loc) · 2.61 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
# Copyright (C) 2015-2016 Franklin "Snaipe" Mathieu.
# Redistribution and use of this file is allowed according to the terms of the MIT license.
# For details see the LICENSE file distributed with Criterion.
cmake_minimum_required (VERSION 2.8)
project (Criterion C)
set (MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.cmake/Modules")
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MODULE_DIR})
if (POLICY CMP0054)
# http://www.cmake.org/cmake/help/v3.1/policy/CMP0054.html
# This is here to allow conditions to be passed as function parameters
cmake_policy (SET CMP0054 OLD)
endif ()
# Initialization
include (Options)
include (Properties)
include (Submodules)
include (Capabilities)
include (Subprojects)
include (PackageUtils)
cr_add_subproject (csptr PATH dependencies/libcsptr
OPTS -DLIBCSPTR_TESTS=OFF
CMAKE)
cr_add_subproject (dyncall_s PATH dependencies/dyncall CMAKE IF THEORIES)
cr_add_subproject (nanomsg
PATH dependencies/nanomsg-patched
OPTS "-DNN_TESTS=OFF" "-DNN_FORK_STRATEGY=reset" "-DNN_STATIC_LIB=ON"
CMAKE
)
cr_add_subproject (wingetopt PATH dependencies/wingetopt CMAKE IF MSVC)
add_definitions (-DNN_STATIC_LIB)
include_directories(
dependencies/valgrind/include/
dependencies/klib/
dependencies/nanopb/
)
# Coverage
if (COVERALLS)
include(Coveralls)
coveralls_turn_on_coverage()
endif()
# I18N
if (I18N AND GETTEXT_FOUND AND LIBINTL_LIB_FOUND)
include(GettextTranslate)
add_subdirectory(po)
endif ()
# Project
include_directories(include src)
add_subdirectory (src)
cr_add_library(criterion SHARED
SOURCES ${SOURCE_FILES}
HEADERS ${INTERFACE_FILES}
COMPONENT dev
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_SOVERSION}
)
cr_link_subproject(criterion csptr STATIC)
cr_link_subproject(criterion nanomsg STATIC)
cr_link_subproject(criterion dyncall_s STATIC)
cr_link_subproject(criterion wingetopt STATIC)
cr_link_libraries(criterion pthread IF NOT WIN32)
cr_link_libraries(criterion rt IF HAVE_CLOCK_GETTIME)
# Required by nanomsg
cr_link_libraries(criterion anl IF NOT WIN32 AND NOT APPLE)
cr_link_libraries(criterion ws2_32 mswsock IF WIN32)
cr_link_package(criterion PCRE)
cr_link_package(criterion LIBINTL)
if (COVERALLS)
coveralls_setup("${SOURCE_FILES}" ${COVERALLS_UPLOAD})
add_custom_target(gcov
"${CMAKE_COMMAND}"
-DSOURCE_FILES="${SOURCE_FILES}"
-DCOV_PATH="${CMAKE_CURRENT_BINARY_DIR}"
-P "${CMAKE_MODULE_PATH}/Gcov.cmake"
)
endif()
if (CTESTS)
enable_testing()
add_custom_target(criterion_tests)
add_subdirectory(samples)
add_subdirectory(test)
endif ()
if (UPLOAD_DEB)
include (DebUpload)
endif ()