-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
59 lines (46 loc) · 1.42 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
# --- cmake minimum version ---
cmake_minimum_required(VERSION 3.20)
# add this options before PROJECT keyword
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
# ---- Main Project ----
project(
pawndb
VERSION 0.1
LANGUAGES CXX)
# Set the standard to ISO C++17 without extensions
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Build shared libraries by default
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
# ---- Create library ----
add_library(${PROJECT_NAME} "")
# include paths
target_include_directories(
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/>)
# Install to system default path minimum
include(cmake/install.cmake)
# --- Configure ccache ---
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
endif()
# --- Options ---
option(PAWNDB_ENABLE_DOXYGEN "Build documentation with Doxygen" OFF)
option(PAWNDB_ENABLE_STYLE "Enable style checks" OFF)
option(PAWNDB_ENABLE_TEST "Enable testing targets" OFF)
# --- Include standalone and test ---
enable_testing()
add_subdirectory("source")
add_subdirectory("standalone")
if (PAWNDB_ENABLE_TEST)
add_subdirectory("test")
endif()
if (PAWNDB_ENABLE_DOXYGEN)
add_subdirectory("docs")
endif()
if (PAWNDB_ENABLE_STYLE)
add_subdirectory("style")
endif()