-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
38 lines (31 loc) · 1.13 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
cmake_minimum_required(VERSION 3.12.4)
project(TaskTorrentTests VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-Wall -Wextra -Wpedantic)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(AddGoogleTest)
if(NOT TTOR_SAN)
set(TTOR_SAN "OFF")
endif()
if(${TTOR_SAN} MATCHES "ADDRESS")
message("Adding -fsanitize=address")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -O2")
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=address")
endif()
if(${TTOR_SAN} MATCHES "THREAD")
message("Adding -fsanitize=thread")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -O2") # Absurdingly slow without -O2
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=thread")
endif()
if(${TTOR_SAN} MATCHES "UB")
message("Adding -fsanitize=undefined")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -O2")
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=undefined")
endif()
add_subdirectory(tasktorrent/src)
if(TTOR_SHARED)
add_subdirectory(tests/shared)
else()
add_subdirectory(tests/mpi)
endif()