This repository has been archived by the owner on May 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
84 lines (46 loc) · 1.75 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
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright (c) 2021 Sapphire's Suite. All Rights Reserved.
cmake_minimum_required(VERSION 3.16)
# === Projects ===
# Create CMake project.
project(SA-UnitTestHelper)
message("Main directory: ${CMAKE_SOURCE_DIR}")
# === Input ===
# Add interface library target.
add_library(SA-UnitTestHelper INTERFACE)
# Add SA-UnitTestHelper.hpp include directory.
target_include_directories(SA-UnitTestHelper INTERFACE .)
# === Compile features ===
# Standard
target_compile_features(SA-UnitTestHelper INTERFACE cxx_std_17)
# UTH module implementation preprocessor.
target_compile_definitions(SA-UnitTestHelper INTERFACE SA_UTH_IMPL)
# === Option ===
# Default console log toggle value.
option(SA_UTH_DFLT_CSL_LOG "Should Log tests in console by default" ON)
if(SA_UTH_DFLT_CSL_LOG)
target_compile_definitions(SA-UnitTestHelper INTERFACE SA_UTH_DFLT_CSL_LOG)
endif()
# Default file log toggle value.
option(SA_UTH_DFLT_FILE_LOG "Should Log tests in a file by default" ON)
if(SA_UTH_DFLT_FILE_LOG)
target_compile_definitions(SA-UnitTestHelper INTERFACE SA_UTH_DFLT_FILE_LOG)
endif()
# Test exit on first failure.
option(SA_UTH_EXIT_ON_FAILURE "Exit on first failure" OFF)
if(SA_UTH_EXIT_ON_FAILURE)
target_compile_definitions(SA-UnitTestHelper INTERFACE SA_UTH_EXIT_ON_FAILURE)
endif()
# Test exit on first failure.
option(SA_UTH_EXIT_PAUSE "Should pause program on exit" OFF)
if(SA_UTH_EXIT_PAUSE)
target_compile_definitions(SA-UnitTestHelper INTERFACE SA_UTH_EXIT_PAUSE)
endif()
# Add SA-UnitTestHelper's examples to build tree.
option(SA_UTH_BUILD_EXAMPLES "Should build SA-Engine tests" OFF)
# === Tests ===
# Enable testing for this directory and below.
enable_testing()
# === Entrypoints ===
if(SA_UTH_BUILD_EXAMPLES)
add_subdirectory(Examples)
endif()