-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
61 lines (47 loc) · 1.57 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
cmake_minimum_required(VERSION 3.19.0)
# Add ./cmake to the module path
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/cmake/macros)
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0135 NEW)
endif()
include(Options)
include(macros)
# Resolve dependencies before applying C++20 standards to avoid incompatibility
if (${ECSTASY_INTEGRATIONS_SFML})
set(SFML_STATIC_LIBRARIES TRUE)
find_package(SFML 2.5.1 COMPONENTS graphics window system REQUIRED)
endif()
if (${ECSTASY_SERIALIZER_TOML})
find_package(Toml++)
set(TomlPlusPlus_IncDir ${tomlplusplus_SOURCE_DIR}/include)
endif()
if (${ECSTASY_SERIALIZER_JSON})
find_package(RapidJson)
endif()
project(ecstasy LANGUAGES CXX)
set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
include(DetectCompiler)
set(ECSTASY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib/")
file(MAKE_DIRECTORY ${ECSTASY_OUTPUT_DIRECTORY})
set(BUILDING_TESTS 0)
add_subdirectory(src)
# Unit testing
if(BUILD_TEST_SUITE)
# Check for GoogleTest
find_package(googletest REQUIRED)
# Disable error on Linux release builds
if(COMPILER_TYPE MATCHES "gcc")
target_compile_options(gtest PRIVATE "-Wno-error=restrict")
target_compile_options(gmock PRIVATE "-Wno-error=restrict")
endif()
enable_testing()
set(BUILDING_TESTS 1)
add_subdirectory(tests)
endif()