-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
72 lines (60 loc) · 2.14 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.9.0)
project(knocknock
VERSION 0.1
LANGUAGES CXX)
# Enable all warnings. Unfortunately MSVC and GCC/Clang require different flags.
if (MSVC)
add_compile_options(/W4)
else ()
add_compile_options(-Wall -Wextra -pedantic)
endif ()
# Force MSVC to correctly report the value of __cplusplus.
if (MSVC)
add_compile_options(-Zc:__cplusplus)
endif ()
if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
include(CheckIPOSupported)
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error LANGUAGES CXX)
if (LTO_SUPPORTED)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
# Force enable policy CMP0069 to force third party dependencies to honor the
# INTERPROCEDURAL_OPTIMIZATION flag.
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
message(STATUS "LTO enabled for all targets")
else ()
message(STATUS "LTO not available: ${error}")
endif ()
endif ()
option(USE_SYSTEM_GLOG "If enabled, use system supplied glog instead of the included version in third_party/" OFF)
if (USE_SYSTEM_GLOG)
find_package(glog REQUIRED)
else ()
set(WITH_GFLAGS OFF CACHE BOOL "Disable gflags")
set(BUILD_TESTING OFF CACHE BOOL "Disable building unittests for glog")
add_subdirectory("third_party/glog")
endif ()
option(USE_SYSTEM_FMT "If enabled, use system supplied fmt instead of the included version in third_party/" OFF)
if (USE_SYSTEM_FMT)
find_package(fmt REQUIRED)
else ()
add_subdirectory("third_party/fmt")
endif ()
option(USE_SYSTEM_CATCH2 "If enabled, use system supplied Catch2 instead of the included version in third_party/" OFF)
if (USE_SYSTEM_CATCH2)
find_package(Catch2 REQUIRED)
else ()
add_subdirectory("third_party/Catch2")
endif ()
find_package(SDL2 REQUIRED)
# Do not build glbinding tools and examples
set(OPTION_BUILD_TOOLS OFF)
set(OPTION_BUILD_EXAMPLES OFF)
set(OPTION_BUILD_WITH_LTO ON)
add_subdirectory(third_party/glbinding)
option(WITH_CLI_FRONTEND "Build the CLI frontend" OFF)
option(WITH_SDL_FRONTEND "Build the SDL frontend" OFF)
option(WITH_TESTS "Build tests" OFF)
add_subdirectory("src")
if (WITH_TESTS)
add_subdirectory("test")
endif()