forked from apache/incubator-pegasus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (54 loc) · 2.41 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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
project(pegasus)
cmake_minimum_required(VERSION 3.11.0)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# require at least gcc 7.0.0
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)
message(FATAL_ERROR "GCC version must be at least 7.0.0!")
endif ()
endif ()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")
include(CompilerInfo)
include(BaseFunctions)
# Always generate the compilation database file (compile_commands.json) for use
# with various development tools, such as IWYU and Vim's YouCompleteMe plugin.
# See http://clang.llvm.org/docs/JSONCompilationDatabase.html
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
set(THIRDPARTY_ROOT ${PROJECT_ROOT}/thirdparty)
set(THIRDPARTY_INSTALL_DIR ${PROJECT_ROOT}/thirdparty/output)
message(STATUS "THIRDPARTY_INSTALL_DIR = ${THIRDPARTY_INSTALL_DIR}")
set(BUILD_DIR ${PROJECT_ROOT}/src/builder)
message(STATUS "BUILD_DIR = ${BUILD_DIR}")
option(BUILD_TEST "build unit test" ON)
message(STATUS "BUILD_TEST = ${BUILD_TEST}")
option(ENABLE_GCOV "Enable gcov (for code coverage analysis)" OFF)
message(STATUS "ENABLE_GCOV = ${ENABLE_GCOV}")
# Disable this option before running valgrind.
option(ENABLE_GPERF "Enable gperftools (for tcmalloc)" ON)
message(STATUS "ENABLE_GPERF = ${ENABLE_GPERF}")
option(USE_JEMALLOC "Use jemalloc" OFF)
message(STATUS "USE_JEMALLOC = ${USE_JEMALLOC}")
if(ENABLE_GPERF AND USE_JEMALLOC)
message(FATAL_ERROR "cannot enable both gperftools and jemalloc simultaneously")
endif()
if(USE_JEMALLOC)
message(STATUS "jemalloc is enabled")
set(JEMALLOC_LIB_TYPE "SHARED")
endif()
add_subdirectory(src)