forked from vesoft-inc/nebula-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
80 lines (72 loc) · 2.67 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
# Copyright (c) 2018 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
#
# CMakeLists.txt file contains a set of directives and instructions describing
# the project's source files and targets (executable, library, or both).
#
# The building can be controlled by defining the following variables on the
# <cmake> command line.
#
# CMAKE_C_COMPILER -- Specify the compiler for C language
# CMAKE_CXX_COMPILER -- Specify the compiler for C++ language
#
# NEBULA_THIRDPARTY_ROOT -- Specify the root directory for third-party
# NEBULA_OTHER_ROOT -- Specify the root directory for user building
# -- Split with ":", exp: DIR:DIR
# NEBULA_CLANG_USE_GCC_TOOLCHAIN -- Specify the root of GCC's toolchain, used by Clang
# NEBULA_USE_LINKER -- Set linker to use, options are: bfd, gold
#
# ENABLE_JEMALLOC -- Link jemalloc into all executables
# ENABLE_TESTING -- Build unit test
# ENABLE_PACK_ONE -- Package to one or multi packages
#
# CMake version check
cmake_minimum_required(VERSION 3.9.0)
# Set the project name
project("Nebula Common" C CXX)
set(PACKAGE_NAME "nebula-common")
add_definitions(-DNEBULA_HOME=${CMAKE_SOURCE_DIR})
# To include customized CMake modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/nebula")
set(nebula_common_source_dir ${CMAKE_SOURCE_DIR})
include(PlatformCheck)
include(NebulaCMakeMacros)
include(GeneralCMakeOptions)
include(ABIConfig)
include(GeneralCMakeConfig)
include(GeneralCompilerConfig)
include(LinkerConfig)
include(CcacheConfig)
include(ThirdPartyConfig)
include(SanitizerConfig)
include(GitHooksConfig)
include(GitInfoConfig)
include(NebulaCustomTargets)
include(ClangTidy)
if (NEBULA_BUILD_VERSION)
add_definitions(-DNEBULA_BUILD_VERSION=${NEBULA_BUILD_VERSION})
endif()
# Remove the target exporting file
file(REMOVE ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-config.cmake)
# For simplicity, we make all ordinary libraries depend on the build-time generated files
macro(nebula_add_library name type)
add_library(${name} ${type} ${ARGN})
export(
TARGETS ${name}
NAMESPACE "common_"
APPEND
FILE ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-config.cmake
)
add_dependencies(
${name}
common_thrift_generator
graph_thrift_generator
storage_thrift_generator
meta_thrift_generator
raftex_thrift_generator
)
endmacro()
add_subdirectory(src/common)