-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (45 loc) · 1.55 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
cmake_minimum_required(VERSION 3.8)
project(Coffee-mill)
enable_testing()
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
execute_process(COMMAND git submodule update --init --recursive WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-O2" COMPILER_SUPPORTS_O2)
check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
check_cxx_compiler_flag("-mtune=native" COMPILER_SUPPORTS_MTUNE_NATIVE)
check_cxx_compiler_flag("-Wall" COMPILER_SUPPORTS_Wall)
check_cxx_compiler_flag("-Wextra" COMPILER_SUPPORTS_Wextra)
check_cxx_compiler_flag("-Wpedantic" COMPILER_SUPPORTS_Wpedantic)
if(COMPILER_SUPPORTS_O2)
add_definitions(-O2)
endif()
if(COMPILER_SUPPORTS_Wall)
add_definitions(-Wall)
endif()
if(COMPILER_SUPPORTS_Wextra)
add_definitions(-Wextra)
endif()
if(COMPILER_SUPPORTS_Wpedantic)
add_definitions(-Wpedantic)
endif()
if(COMPILER_SUPPORTS_MARCH_NATIVE)
add_definitions(-march=native)
endif()
if(COMPILER_SUPPORTS_MTUNE_NATIVE)
add_definitions(-mtune=native)
endif()
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/extlib)
add_subdirectory(src)
# tests --------------------------------------------------------------------
find_package(Boost)
if(Boost_FOUND)
message(STATUS "Boost ${Boost_VERSION} found at ${Boost_INCLUDE_DIRS}")
include_directories(${Boost_INCLUDE_DIRS})
add_subdirectory(tests)
endif()