-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
97 lines (72 loc) · 2.21 KB
/
CMakeLists.txt
File metadata and controls
97 lines (72 loc) · 2.21 KB
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
cmake_minimum_required(VERSION 3.13)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
include(SetupDependencyResolution)
include(EnsureNotInSourceBuild)
#
# Modules
#
# Core modules
option(LIBBASE_BUILD_MODULE_NET "Build networking module." ON)
option(LIBBASE_BUILD_MODULE_WIN "Build WinApi integration module." ON)
# Optional modules
option(LIBBASE_BUILD_MODULE_WX "Build wxWidgets integration module." OFF)
# Dependency resolution for optional modules/features
if(LIBBASE_BUILD_USES_VCPKG)
if(LIBBASE_BUILD_MODULE_WX)
list(APPEND VCPKG_MANIFEST_FEATURES "wx")
endif()
endif()
#
# Project setup
#
project(libbase
VERSION 1.1.2
LANGUAGES CXX)
include(ProjectIsTopLevel)
#
# Build options
#
option(LIBBASE_BUILD_EXAMPLES "Build examples." ${PROJECT_IS_TOP_LEVEL_OPT})
option(LIBBASE_BUILD_TESTS "Build unit tests." ${PROJECT_IS_TOP_LEVEL_OPT})
option(LIBBASE_BUILD_PERFORMANCE_TESTS "Build performance tests." ${PROJECT_IS_TOP_LEVEL_OPT})
option(LIBBASE_CLANG_TIDY "Build with clang-tidy" ${PROJECT_IS_TOP_LEVEL_OPT})
option(LIBBASE_CODE_COVERAGE "Compute code coverage." OFF)
option(LIBBASE_BUILD_DOCS "Build documentation." OFF)
option(LIBBASE_BUILD_ASAN "Build with Address Sanitizer enabled" OFF)
option(LIBBASE_BUILD_TSAN "Build with Thread Sanitizer enabled" OFF)
if(LIBBASE_BUILD_MODULE_WIN AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(LIBBASE_BUILD_MODULE_WIN OFF CACHE BOOL "" FORCE)
endif()
set(LIBBASE_OUTPUT_NAME "libbase" CACHE STRING
"The library's output basename. Modify to resolve name clashes.")
#
# Targets
#
include(SetupCompileFlags)
include(SetupInstallRules)
# libbase library
add_subdirectory(src)
if(PROJECT_IS_TOP_LEVEL)
# Example applications
if (LIBBASE_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
# Tests
if(LIBBASE_BUILD_TESTS)
enable_testing()
endif()
if(LIBBASE_BUILD_TESTS OR LIBBASE_BUILD_PERFORMANCE_TESTS)
add_subdirectory(tests)
endif()
# Documentation
if (LIBBASE_BUILD_DOCS)
add_subdirectory(docs)
endif()
endif()
#
# Installation
#
if(PROJECT_IS_TOP_LEVEL AND NOT CMAKE_SKIP_INSTALL_RULES)
libbase_install_rules()
endif()