-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
59 lines (47 loc) · 1.42 KB
/
Copy pathCMakeLists.txt
File metadata and controls
59 lines (47 loc) · 1.42 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
cmake_minimum_required(VERSION 3.16)
project(OneBase
VERSION 0.1.0
DESCRIPTION "An educational RDBMS"
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Output binaries to bin/
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
option(ONEBASE_BUILD_TESTS "Build tests" ON)
option(ONEBASE_BUILD_TOOLS "Build tool binaries" ON)
# Compiler warnings (stored in variable for reuse)
set(ONEBASE_CXX_FLAGS
-Wall -Wextra -Wpedantic
-Wno-unused-parameter
-fno-omit-frame-pointer
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND ONEBASE_CXX_FLAGS -fsanitize=address -fno-sanitize=leak -g -O0)
add_link_options(-fsanitize=address -fno-sanitize=leak)
endif()
# Third-party dependencies (find_package at root scope so targets are globally visible)
find_package(GTest REQUIRED)
find_package(fmt REQUIRED)
message(STATUS "Found GTest: ${GTest_VERSION}")
message(STATUS "Found fmt: ${fmt_VERSION}")
# Global include path
include_directories(${PROJECT_SOURCE_DIR}/src/include)
# Third-party libraries (libpg_query, etc.)
add_subdirectory(third_party)
# Core libraries
add_subdirectory(src)
# Tests
if(ONEBASE_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()
# Tools
if(ONEBASE_BUILD_TOOLS)
add_subdirectory(tools)
endif()