-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
99 lines (86 loc) · 3.63 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
cmake_minimum_required(VERSION 3.15)
project(YDB-CPP-SDK LANGUAGES C CXX ASM)
option(YDB_SDK_INSTALL "Install YDB C++ SDK" Off)
option(YDB_SDK_TESTS "Build YDB C++ SDK tests" Off)
option(YDB_SDK_EXAMPLES "Build YDB C++ SDK examples" On)
set(YDB_SDK_GOOGLE_COMMON_PROTOS_TARGET "" CACHE STRING "Name of cmake target preparing google common proto library")
option(YDB_SDK_USE_RAPID_JSON "Search for rapid json library in system" ON)
set(BUILD_SHARED_LIBS Off)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED On)
set(CMAKE_CXX_EXTENSIONS On)
set(YDB_SDK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(YDB_SDK_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(YDB-CPP-SDK_AVAILABLE_COMPONENTS "" CACHE INTERNAL "")
set(YDB-CPP-SDK_COMPONENT_TARGETS "" CACHE INTERNAL "")
file(READ "src/client/resources/ydb_sdk_version.txt" YDB_SDK_VERSION)
#[=============================================================================[
NOTE: if `ccache` is used with the environment variable `CCACHE_BASEDIR`,
these cached variable should be set manually by passing them to `cmake` as
`-DARCADIA_ROOT=source/path/relative/to/build/dir` and
`-DARCADIA_BUILD_ROOT=.`, because in that case the macro `__FILE__` will be
expanded to a relative path, even if the source code file was specified as
an absolute path, and we have to know the proper prefix of that path.
See details: https://ccache.dev/manual/3.1.html#_compiling_in_different_directories
#]=============================================================================]
set(ARCADIA_ROOT ${YDB_SDK_SOURCE_DIR} CACHE INTERNAL "The source root directory")
set(ARCADIA_BUILD_ROOT ${YDB_SDK_BINARY_DIR} CACHE INTERNAL "The build root directory")
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
list(APPEND CMAKE_MODULE_PATH ${YDB_SDK_SOURCE_DIR}/cmake)
include(cmake/global_flags.cmake)
include(cmake/global_vars.cmake)
include(cmake/install.cmake)
include(cmake/common.cmake)
include(cmake/ccache.cmake)
include(cmake/protobuf.cmake)
include(cmake/testing.cmake)
include(cmake/external_libs.cmake)
if (YDB_SDK_TESTS)
enable_testing()
endif()
add_subdirectory(tools)
add_subdirectory(contrib/libs)
add_subdirectory(library/cpp)
add_subdirectory(include/ydb-cpp-sdk/client)
add_subdirectory(src)
add_subdirectory(util)
#_ydb_sdk_validate_public_headers()
if (YDB_SDK_EXAMPLES)
add_subdirectory(examples)
endif()
if (YDB_SDK_TESTS)
add_subdirectory(tests)
endif()
if (YDB_SDK_INSTALL)
_ydb_sdk_install_headers(${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT ydb-cpp-sdk-targets
FILE ydb-cpp-sdk-targets.cmake
CONFIGURATIONS RELEASE
NAMESPACE YDB-CPP-SDK::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ydb-cpp-sdk/release
)
configure_package_config_file(
${YDB_SDK_SOURCE_DIR}/cmake/ydb-cpp-sdk-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/ydb-cpp-sdk-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ydb-cpp-sdk
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/ydb-cpp-sdk-config-version.cmake
VERSION ${YDB_SDK_VERSION} COMPATIBILITY SameMajorVersion
)
_ydb_sdk_directory_install(FILES
${CMAKE_CURRENT_BINARY_DIR}/ydb-cpp-sdk-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/ydb-cpp-sdk-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ydb-cpp-sdk
)
_ydb_sdk_directory_install(FILES
${YDB_SDK_SOURCE_DIR}/cmake/FindBrotli.cmake
${YDB_SDK_SOURCE_DIR}/cmake/FindgRPC.cmake
${YDB_SDK_SOURCE_DIR}/cmake/FindIDN.cmake
${YDB_SDK_SOURCE_DIR}/cmake/FindLZ4.cmake
${YDB_SDK_SOURCE_DIR}/cmake/FindxxHash.cmake
${YDB_SDK_SOURCE_DIR}/cmake/FindZSTD.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ydb-cpp-sdk/Modules
)
endif()