-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
82 lines (69 loc) · 3.29 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
# This is the main CMake file for the yaml-archive project.
#
# It sets some options and adds the src directory as a cmake subdirectory. The
# CMake file in the src directory is responsible for defining the yaml-archive
# target.
#
# Optionally, it will add the test subdirectory. The CMake file in that
# directory will define test targets to be run by CTest.
#
# Optionally, it will add the doc subdirectory. The CMake file in that directory
# will define the doc target to build the html documentation. Doxygen is
# required to build the documentation. If doxygen is not found, the doc
# target will not be available.
cmake_minimum_required(VERSION 3.0)
project(yaml-archive VERSION 0.1.0 LANGUAGES CXX)
set(yaml-archive_WE_ARE_ROOT OFF CACHE INTERNAL "")
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(yaml-archive_WE_ARE_ROOT ON CACHE INTERNAL "")
endif()
################################################################################
# #
# Options #
# #
################################################################################
option(yaml-archive_USE_STATIC_LIBS
"Build static libraries instead of dynamic ones."
${BUILD_STATIC_LIBS})
option(yaml-archive_BUILD_UNIT_TESTS
"Build the unit tests?"
${yaml-archive_WE_ARE_ROOT})
find_package(Doxygen)
if (${DOXYGEN_FOUND} AND ${yaml-archive_WE_ARE_ROOT})
option(yaml-archive_BUILD_DOCUMENTATION
"Build the documentation?"
ON)
else()
option(yaml-archive_BUILD_DOCUMENTATION
"Build the documentation?"
OFF)
endif()
set(yaml-archive_LIB_DESTINATION lib
CACHE PATH
"Where to install the library")
set(yaml-archive_INCLUDE_DESTINATION .
CACHE PATH
"Where to install the headers")
################################################################################
# #
# Target yaml-archive #
# #
################################################################################
add_subdirectory(src)
################################################################################
# #
# Unit tests #
# #
################################################################################
if (yaml-archive_BUILD_UNIT_TESTS)
enable_testing()
add_subdirectory(test)
endif()
################################################################################
# #
# Documentation (with doxygen) #
# #
################################################################################
if (yaml-archive_BUILD_DOCUMENTATION)
add_subdirectory(doc)
endif()