-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
68 lines (41 loc) · 1.4 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
# Copyright (c) 2023 Sapphire's Suite. All Rights Reserved.
cmake_minimum_required(VERSION 3.16)
# Sapphire Suite's CMake tools.
add_subdirectory(ThirdParty/SA/CMake)
# Project
project(SA_Logger)
SA_ConfigureProject(SA_Logger)
# Library
add_library(SA_Logger STATIC)
SA_ConfigureTarget(SA_Logger)
SA_TargetSources(SA_Logger)
### Link dependencies.
target_link_libraries(SA_Logger PUBLIC SA_Support)
### Thread
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(SA_Logger PUBLIC Threads::Threads)
### Advanced MSVC preprocessor required for Core::Debug
### https://docs.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
if(${MSVC_TOOLSET_VERSION} LESS 142)
target_compile_options(SA_Logger PUBLIC /experimental:preprocessor)
else()
target_compile_options(SA_Logger PUBLIC /Zc:preprocessor)
endif()
endif()
# Options
## Add SA_Logger's tests to build tree.
option(SA_LOGGER_BUILD_TESTS_OPT "Should build SA_Logger tests" OFF)
## SA_Logger should log even in release.
option(SA_LOG_RELEASE_OPT "Should log in release" ON)
if(SA_LOG_RELEASE_OPT)
target_compile_definitions(SA_Logger PUBLIC SA_LOG_RELEASE_OPT)
endif()
# Entrypoints
add_subdirectory(ThirdParty)
if(SA_LOGGER_BUILD_TESTS_OPT)
### Enable testing for this directory and below.
enable_testing()
add_subdirectory(Tests)
endif()