-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
87 lines (73 loc) · 4.16 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
##===================================================================================================
## Copyright 2015 Joel Falcou
##
## Distributed under the Boost Software License, Version 1.0.
## See accompanying file LICENSE.txt or copy at
## http://www.boost.org/LICENSE_1_0.txt
##===================================================================================================
cmake_minimum_required(VERSION 2.8.7)
##===================================================================================================
## Setup project
##===================================================================================================
project(STF CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
##===================================================================================================
## Prevent in-source build
##===================================================================================================
if(${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
message( FATAL_ERROR "Building in-source, not recommended! Build in a separate directory." )
endif()
##===================================================================================================
## Search for packages.
##===================================================================================================
find_package(Boost 1.58)
find_package(Doxygen QUIET)
##===================================================================================================
## Install pre-commit git hook
##===================================================================================================
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_SOURCE_DIR}/script/git/pre-commit
${PROJECT_SOURCE_DIR}/.git/hooks
)
##===================================================================================================
## Compute version string and mode
##===================================================================================================
include(parse_revision)
##===================================================================================================
## Add include directories
##===================================================================================================
include_directories(${PROJECT_SOURCE_DIR}/include ${Boost_INCLUDE_DIRS})
##===================================================================================================
## Setup Documentation
##===================================================================================================
add_subdirectory(doc)
##===================================================================================================
## Install target
##===================================================================================================
install ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/stf
DESTINATION include
)
##===================================================================================================
## Standalone generator target
##===================================================================================================
add_custom_target(standalone
COMMAND ${CMAKE_COMMAND} -E remove ${PROJECT_SOURCE_DIR}/standalone/stf.hpp
COMMAND python ${PROJECT_SOURCE_DIR}/script/embed.py -I include/ --include-match=stf/* include/stf/stf.hpp -o standalone/stf.hpp
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Building standalone header file"
VERBATIM
)
##===================================================================================================
## Setup Testing
##===================================================================================================
enable_testing()
##===================================================================================================
## Setup Coverage Test
##===================================================================================================
add_custom_target(tests)
add_custom_target(unit)
include(coverage)
enable_testing()
enable_coverage(stf)
add_dependencies(tests unit)
add_subdirectory(test)