-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
56 lines (49 loc) · 1.65 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
cmake_minimum_required(VERSION 3.21)
set (PROJECT_NAME zip_in_cpp)
project(${PROJECT_NAME}
VERSION 1.0
DESCRIPTION "Zip in Cpp"
LANGUAGES CXX)
#set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror")
if (APPLE)
#debug
add_definitions(-D__GLIBCXX__)
#Threads not found
if(NOT Threads_FOUND)
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
endif()
endif (APPLE)
find_package(GTest REQUIRED)
if(GTest_FOUND)
message(STATUS " <===> FOUND GTest, including and linking...")
include_directories(${GTEST_INCLUDE_DIRS})
add_executable(${PROJECT_NAME}_tests tests_itertools.cpp)
target_compile_options(${PROJECT_NAME}_tests
PRIVATE
-fsanitize=address -g -fno-omit-frame-pointer -fno-optimize-sibling-calls
-fsanitize=undefined -g -fno-omit-frame-pointer
# -fsanitize=leak -g
# -fsanitize=thread -fPIE -pie -g
)
target_link_options(${PROJECT_NAME}_tests
PRIVATE
-fsanitize=address
-fsanitize=undefined
# -fsanitize=leak
# -fsanitize=thread
)
target_link_libraries(${PROJECT_NAME}_tests
GTest::GTest
pthread
)
enable_testing()
include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
else()
message(STATUS " <===> NOT FOUND GTest, nothing to run the tests on")
endif()