-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
34 lines (26 loc) · 1.32 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
cmake_minimum_required(VERSION 3.24)
project(Project1)
set(CMAKE_CXX_STANDARD 14)
#recommended by aman to match test environment
set(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}" )
#pull in desired version of catch through cmake automatically, make it available
Include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.0.1 # or a later release
)
FetchContent_MakeAvailable(Catch2)
include_directories(test-unit)
#the first word is the name of the executble
# everything else are the files to include - yours will probably look a bit different than mine
add_executable(Main
src/main.cpp # your main
src/AVL.cpp src/AVL.h src/Parser.cpp src/Parser.h src/StudentNode.h)
#this one doesn't include main, instead having your test.cpp
add_executable(Tests #this will be named Project1 by default - either change it to Tests or see the comment at the bottom of the file
test-unit/test.cpp # your test file
src/AVL.cpp src/AVL.h src/Parser.cpp src/Parser.h src/StudentNode.h)
target_link_libraries(Tests PRIVATE Catch2::Catch2WithMain) #link catch to test.cpp file
#if your testing executable is named Project1, change Tests in the line above to Project1