-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
34 lines (26 loc) · 1.09 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.21)
project(persistent-set)
set(CMAKE_CXX_STANDARD 20)
find_package(GTest REQUIRED)
add_executable(tests tests.cpp
test-helpers/element.cpp
test-helpers/fault_injection.cpp)
if (NOT MSVC)
target_compile_options(tests PRIVATE -Wall -Wextra -Wshadow=compatible-local -Wno-sign-compare -pedantic)
endif ()
option(USE_SANITIZERS "Enable to build with undefined,leak and address sanitizers" OFF)
if (USE_SANITIZERS)
message(STATUS "Enabling sanitizers...")
target_compile_options(tests PUBLIC -fsanitize=address,undefined,leak -fno-sanitize-recover=all)
target_link_options(tests PUBLIC -fsanitize=address,undefined,leak)
endif ()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Enabling libc++...")
target_compile_options(tests PUBLIC -stdlib=libc++)
target_link_options(tests PUBLIC -stdlib=libc++)
endif ()
if (CMAKE_BUILD_TYPE MATCHES "Debug")
message(STATUS "Enabling _GLIBCXX_DEBUG...")
target_compile_options(tests PUBLIC -D_GLIBCXX_DEBUG)
endif ()
target_link_libraries(tests GTest::gtest GTest::gtest_main)