-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (45 loc) · 1.82 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
cmake_minimum_required(VERSION 3.0.0)
project(chestnut-ecs VERSION 1.3.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
# =============================== ALLOW OFFLINE MODE ===================================
FetchContent_Declare(
FetchContentOffline
GIT_REPOSITORY https://github.com/SpontanCombust/cmake-fetchcontent-offline
)
set(FETCHCONTENT_UPDATES_DISCONNECTED_FETCHCONTENTOFFLINE ON)
FetchContent_MakeAvailable(FetchContentOffline)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${fetchcontentoffline_SOURCE_DIR}")
include(fetchcontent-offline)
FetchContent_DisconnectedIfOffline()
## ======================================== ECS Core ========================================
FetchContent_Declare(
typelist
GIT_REPOSITORY https://github.com/SpontanCombust/cpp-typelist
GIT_TAG master
)
FetchContent_MakeAvailable(typelist)
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(${PROJECT_NAME} INTERFACE typelist)
## ========================================== Tests ========================================
FetchContent_Declare(
catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2
GIT_TAG v2.13.7
)
FetchContent_MakeAvailable(catch2)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib)
find_package(Threads)
add_executable(${PROJECT_NAME}_Test)
add_subdirectory(tests)
target_link_libraries(${PROJECT_NAME}_Test ${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME}_Test Catch2::Catch2 Threads::Threads)
target_compile_options(${PROJECT_NAME}_Test PRIVATE
# 4834 - ignored [[nodiscard]] (warning coming from cpp-typelist)
$<$<CXX_COMPILER_ID:MSVC>: /wd4834 /W4>
)
include(CTest)
include(Catch)
catch_discover_tests(${PROJECT_NAME}_Test)