-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
40 lines (31 loc) · 1.44 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
cmake_minimum_required(VERSION 3.11)
project(Cache VERSION 1.0.0 LANGUAGES CXX)
#---------------------------------------------------------------------------------------
# include CMake modules
#---------------------------------------------------------------------------------------
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(AddCatchTest) # Function add_catch_test()
include(EnableCoverage) # Function target_enable_coverage()
include(EnableWarnings) # Function target_enable_warnings()
#---------------------------------------------------------------------------------------
# set default build to debug
#---------------------------------------------------------------------------------------
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose Release or Debug" FORCE)
endif()
#---------------------------------------------------------------------------------------
# compiler config
#---------------------------------------------------------------------------------------
option(CACHE_BUILD_EXAMPLES "Build example programs" OFF)
option(CACHE_BUILD_TESTS "Build unit tests" OFF)
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
add_library(Cache INTERFACE)
target_include_directories(Cache INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(Cache::Cache ALIAS Cache)
if(CACHE_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(CACHE_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()