-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
69 lines (58 loc) · 1.8 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
cmake_minimum_required(VERSION 3.14)
project(gop2)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Wextra -Os -funsigned-char")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /Os /J")
endif()
include(FetchContent)
# Fetch fmt library
FetchContent_Declare(
fmt
GIT_REPOSITORY /~https://github.com/fmtlib/fmt.git
GIT_TAG 11.0.2
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(fmt)
# Fetch Catch2 library
FetchContent_Declare(
catch2
GIT_REPOSITORY /~https://github.com/catchorg/Catch2.git
GIT_TAG v3.7.1
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(catch2)
# Main executable
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src/include
)
add_executable(gop2 ${SOURCE_FILES})
target_link_libraries(gop2 PRIVATE fmt::fmt)
# Tests executable
file(GLOB_RECURSE TESTS_SOURCE_FILES CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cpp
)
set(TESTS_SOURCE ${TESTS_SOURCE_FILES})
add_executable(gop2_tests
${CMAKE_CURRENT_SOURCE_DIR}/src/game.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/hero_type.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/hero.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/list.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/comm/r.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/comm/_clsc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/comm/sav.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/comm/sstay.cpp
${TESTS_SOURCE})
target_link_libraries(gop2_tests PRIVATE fmt::fmt Catch2::Catch2WithMain)
include(CTest)
include(Catch)
catch_discover_tests(gop2_tests)