-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
40 lines (33 loc) · 1.17 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.8 FATAL_ERROR)
project(ModernCpp LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Compiler setup
if(${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-weak-vtables -Wno-padded")
endif()
# Tooling setup
if(NOT CLANG_TIDY)
set(CLANG_TIDY_DOC_STRING "Path to the Clang Tidy tool")
if(DEFINED ENV{CXX_CLANG_TIDY})
set(CLANG_TIDY "$ENV{CXX_CLANG_TIDY}" CACHE FILEPATH ${CLANG_TIDY_DOC_STRING})
else()
find_program(CLANG_TIDY NAMES clang-tidy DOC ${CLANG_TIDY_DOC_STRING})
endif()
if(NOT CLANG_TIDY)
message(FATAL_ERROR "clang-tidy not in path, use CXX_CLANG_TIDY to specify location")
else()
message(STATUS "Using clang-tidy: ${CLANG_TIDY}")
endif()
endif()
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY}")
# Dependencies
find_package(Boost REQUIRED)
add_library(boost INTERFACE IMPORTED)
set_property(TARGET boost PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
# Production code
add_subdirectory(lib)
add_subdirectory(app)
add_subdirectory(examples)
# Test code
add_subdirectory(tests)