-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
41 lines (34 loc) · 1.31 KB
/
CMakeLists.txt
File metadata and controls
41 lines (34 loc) · 1.31 KB
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
cmake_minimum_required(VERSION 3.16.0)
project(dsm_tests VERSION 1.3.10 LANGUAGES CXX)
# Set the C++ standard
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Add code coverage options
if(CMAKE_BUILD_TYPE STREQUAL "COVERAGE")
message(STATUS "Enable code coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -g --coverage -fprofile-update=atomic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -g -fsanitize=address")
endif()
# Set the folder for the executable
set(EXECUTABLE_OUTPUT_PATH ../)
include(FetchContent)
# Get doctest
FetchContent_Declare(doctest
GIT_REPOSITORY https://github.com/doctest/doctest.git
GIT_TAG v2.4.11
)
FetchContent_GetProperties(doctest)
if(NOT doctest_POPULATED)
FetchContent_MakeAvailable(doctest)
endif()
# add as executable all cpp files into '.' folder
file(GLOB TEST_SOURCES "*.cpp")
file(GLOB SRC_SOURCES "../src/dsm/headers/*.cpp")
list(APPEND SOURCES ${TEST_SOURCES} ${SRC_SOURCES})
# Define the executable
add_executable(dsm_tests.out ${SOURCES})
target_include_directories(dsm_tests.out PRIVATE ../src/dsm/headers/ ../src/dsm/utility/TypeTraits/)
target_include_directories(dsm_tests.out SYSTEM PRIVATE ${doctest_SOURCE_DIR}/doctest)