forked from codership/galera
-
Notifications
You must be signed in to change notification settings - Fork 33
/
CMakeLists.txt
132 lines (116 loc) · 4.12 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
120
121
122
123
124
125
126
127
128
129
130
131
132
#
# Copyright (C) 2020 Codership Oy <info@codership.com>
#
message(STATUS "CMake version ${CMAKE_VERSION}")
cmake_minimum_required(VERSION 2.8)
project(galera-3)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/common
${CMAKE_SOURCE_DIR}/galerautils/src
${CMAKE_SOURCE_DIR}/gcomm/src
${CMAKE_SOURCE_DIR}/gcache/src
${CMAKE_SOURCE_DIR}/gcs/src
${CMAKE_SOURCE_DIR}/wsrep/src
)
# Options to control compiler options and error behavior.
option(GALERA_MAINTAINER_MODE "Fail compilation on warnings" OFF)
# Galera library options.
option(GALERA_WITH_SSL "Compile Galera with SSL" ON)
option(GALERA_VERSION_SCRIPT "Limit symbols visible from Galera DSO" ON)
option(GALERA_STATIC "Build statically linked binaries" OFF)
option(GALERA_SOURCE
"Configure for source package only, skipping build configuration" OFF)
# Developer options and instrumentation.
option(GALERA_WITH_ASAN "Enable ASAN instrumentation" OFF)
option(GALERA_WITH_VALGRIND "Optionally run tests with valgrind" OFF)
option(GALERA_WITH_COVERAGE "Compile with coverage instrumentation" OFF)
option(GALERA_GCS_SM_DEBUG
"Enable dumping of send monitor state and history" OFF)
option(GALERA_GU_DEBUG_MUTEX "Enable mutex debug instrumentation" OFF)
option(GALERA_GU_DBUG_ON "Enable sync point macros (ON for Debug builds)" OFF)
#
# Set cmake policies before doing any checks.
#
# In CMake 3.12 and above, the
#
# * ``check_include_file`` macro in the ``CheckIncludeFile`` module, the
# * ``check_include_file_cxx`` macro in the
# ``CheckIncludeFileCXX`` module, and the
# * ``check_include_files`` macro in the ``CheckIncludeFiles`` module
#
# now prefer to link the check executable to the libraries listed in the
# ``CMAKE_REQUIRED_LIBRARIES`` variable. This policy provides compatibility
# with projects that have not been updated to expect this behavior.
if (POLICY CMP0075)
CMAKE_POLICY(SET CMP0075 OLD)
endif()
# Determine version first to have it near the top of build log.
include(cmake/version.cmake)
include(cmake/package.cmake)
# Do not execute other configuration steps if building source only.
if (GALERA_SOURCE)
return()
endif()
# Source compiler/OS settings first as it sets used C/C++ standards,
# common compiler flags and include/link paths.
include(cmake/compiler.cmake)
include(cmake/os.cmake)
# Instrumentation.
include(cmake/asan.cmake)
# Common definitions for all modues.
include(cmake/common.cmake)
# Libraries, language library features.
include(cmake/ssl.cmake)
include(cmake/asio.cmake)
include(cmake/array.cmake)
include(cmake/boost.cmake)
include(cmake/crc32c.cmake)
include(cmake/endian.cmake)
include(cmake/shared_ptr.cmake)
include(cmake/unordered.cmake)
include(cmake/check.cmake)
include(cmake/memorycheck.cmake)
include(cmake/coverage.cmake)
# Keep the maintainer mode as last to avoid feature checks failing
# in compiler warnings.
include(cmake/maintainer_mode.cmake)
include(CTest)
enable_testing()
add_subdirectory(galerautils)
add_subdirectory(gcomm)
add_subdirectory(gcache)
add_subdirectory(gcs)
add_subdirectory(garb)
add_subdirectory(galera)
add_subdirectory(scripts/packages)
add_subdirectory(wsrep/tests)
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES ".*BSD")
install(FILES
${CMAKE_SOURCE_DIR}/AUTHORS
${CMAKE_SOURCE_DIR}/COPYING
${CMAKE_SOURCE_DIR}/README
DESTINATION doc)
install(FILES ${CMAKE_SOURCE_DIR}/asio/LICENSE_1_0.txt
DESTINATION doc
RENAME LICENSE.asio)
install(FILES ${CMAKE_SOURCE_DIR}/chromium/LICENSE
DESTINATION doc
RENAME LICENSE.chromium)
endif()
message(STATUS "")
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
get_directory_property(DirDefs COMPILE_DEFINITIONS)
message(STATUS "COMPILE_DEFINITIONS: ${DirDefs}")
message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
message(STATUS "GALERA_SYSTEM_LIBS: ${GALERA_SYSTEM_LIBS}")
message(STATUS "GALERA_UNIT_TEST_LIBS: ${GALERA_UNIT_TEST_LIBS}")
message(STATUS "")