-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
72 lines (54 loc) · 1.9 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
cmake_minimum_required(VERSION 3.24)
project(spreadsheet
VERSION 1.1.0
DESCRIPTION "spreadsheet"
HOMEPAGE_URL "https://github.com/IgorKilipenko/cpp-spreadsheet"
LANGUAGES CXX
)
# Set C++ standard to 20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Enable creation of compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Source directiory
set(PROJECT_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
# Public (interface) include directiory
set(PROJECT_PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
# Source directiory
set(PROJECT_TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests")
# Installation directiory
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/bin")
# Set build as shared library. Not implemented yet.!
option(SPREADSHEET_BUILD_SHARED "Build shared library" OFF)
# Enable building tests
option(SPREADSHEET_BUILD_TESTS "Build tests" ON)
# Find required packages
find_package(Threads REQUIRED)
find_package(Java REQUIRED)
# Add threads library for all lib targets
link_libraries(Threads::Threads)
# Include ANTLR setup
include(cmake/setup_antlr.cmake)
# Include DOCTEST setup
include(cmake/setup_doctest.cmake)
# Include source files and create targets
include(cmake/setup_targets.cmake)
# Include installation
include(cmake/install.cmake)
if(CMAKE_PROJECT_NAME STREQUAL "spreadsheet") # if spreadsheet is top-level project
# Set warning flags for Debug build
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(ENABLE_WARNING ON)
endif()
# Add src include dirs
include_directories(include)
include_directories(include/spreadsheet)
include_directories(src/include)
include_directories(src)
include(cmake/utils.cmake)
include(cmake/compile_settings.cmake)
include(cmake/develop.cmake)
include(cmake/setup_tests.cmake)
endif()
set_directory_properties(PROPERTIES VS_STARTUP_PROJECT spreadsheet)