-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
48 lines (37 loc) · 1.46 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
cmake_minimum_required(VERSION 3.8)
project(lockfree_queues)
option(LOCKFREE_QUEUES_BUILD_TESTS "Build the tests" OFF)
option(LOCKFREE_QUEUES_BUILD_BENCHMARKS "Build the benchmarks" OFF)
option(LOCKFREE_QUEUES_SANITIZE_ADDRESS "Enable address sanitizer in tests" OFF)
option(LOCKFREE_QUEUES_SANITIZE_THREAD "Enable thread sanitizer in tests" OFF)
if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif ()
# address sanitizer flags
if (LOCKFREE_QUEUES_SANITIZE_ADDRESS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer -g")
endif ()
# thread sanitizer flags
if (LOCKFREE_QUEUES_SANITIZE_THREAD)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
endif ()
# library name
set(TARGET_NAME lockfree_queues)
# header files
set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/lockfree_queues/sp_broadcast_queue.h
${CMAKE_CURRENT_SOURCE_DIR}/include/lockfree_queues/utilities.h)
# Add this as a library
add_library(${TARGET_NAME} INTERFACE)
# Add target sources
target_sources(${TARGET_NAME} INTERFACE ${HEADER_FILES})
# Add include directories for this library
target_include_directories(${TARGET_NAME} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
if (LOCKFREE_QUEUES_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif ()
if (LOCKFREE_QUEUES_BUILD_BENCHMARKS)
add_subdirectory(benchmark)
endif ()