/
CMakeLists.txt
65 lines (53 loc) · 1.5 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
# Configinator5000
cmake_minimum_required(VERSION 3.12)
if (NOT DEFINED PROJECT_NAME)
set(C5K_IS_SUBPROJECT OFF)
else()
set(C5K_IS_SUBPROJECT ON)
endif()
project(Configinator5000 VERSION 0.1.0
DESCRIPTION "Schema driven configuaration parser/helper"
LANGUAGES CXX)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"DEBUG" "RELEASE" "CI")
#
# Set the default build type to Release (if the user doesn't specify)
#
set(default_build_type "RELEASE")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
endif()
#
# Some options
#
option(BUILD_TEST "Enable tests" ON)
#
# Make sure we use -std=c++17 or higher
#
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if (MSVC)
add_compile_options("$<$<CONFIG:DEBUG>:/Wall>")
add_compile_options("$<$<CONFIG:CI>:/Wall>")
add_compile_options("$<$<CONFIG:RELEASE>:/O2>")
else()
add_compile_options("$<$<CONFIG:DEBUG>:-O0;-Wall;-pedantic>")
add_compile_options("$<$<CONFIG:CI>:-O1;-Wall;-pedantic>")
add_compile_options("$<$<CONFIG:RELEASE>:-O3>")
endif()
add_subdirectory(lib)
#
# other projects we use.
#
add_subdirectory(extern)
#
# build tests
#
if (BUILD_TEST AND NOT C5K_IS_SUBPROJECT)
enable_testing()
add_subdirectory(tests)
endif()