-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
41 lines (34 loc) · 1.56 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
cmake_minimum_required(VERSION 3.1)
project(arkio)
set(CMAKE_CXX_STANDARD 20)
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
if(${WITH_COROUTINES})
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines-ts -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(WARNING "gcc support for coroutines is untested, and libstdc++ lacks coroutine support")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines")
endif()
else()
add_definitions(-DARK_NO_COROUTINES)
endif()
endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(URING REQUIRED liburing)
find_package (Threads)
add_subdirectory(vendor/GSL)
add_subdirectory(vendor/function2)
# ned14/outcome uses quickcpplib which do lots of extra work
# here we use a little magic to include the single-header version only ..
add_library(outcome INTERFACE IMPORTED GLOBAL)
target_include_directories(outcome INTERFACE ${PROJECT_SOURCE_DIR}/vendor/outcome/single-header)
add_library(arkio INTERFACE IMPORTED GLOBAL)
target_include_directories(arkio INTERFACE ${PROJECT_SOURCE_DIR}/include ${URING_INCLUDE_DIRS})
target_link_libraries(arkio INTERFACE ${URING_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} GSL function2 outcome)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory(examples)
enable_testing()
add_subdirectory(tests)
endif()