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
cmake_minimum_required(VERSION 3.10)
project(felspar-coro)

if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
    add_custom_target(felspar-check)
    set_property(TARGET felspar-check PROPERTY EXCLUDE_FROM_ALL TRUE)
    add_custom_target(felspar-examples)
    include(requirements.cmake)
endif()

add_library(felspar-coro INTERFACE)
target_include_directories(felspar-coro INTERFACE include)
target_compile_features(felspar-coro INTERFACE cxx_std_20)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
    target_compile_options(felspar-coro INTERFACE -fcoroutines-ts -Wno-deprecated-experimental-coroutine)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
    target_compile_options(felspar-coro INTERFACE
            -fcoroutines
            -Wno-mismatched-new-delete
        )
else()
    message(SEND_ERROR "Unknown compiler ID: ${CMAKE_CXX_COMPILER_ID}")
endif()
target_link_libraries(felspar-coro INTERFACE felspar-memory)
install(DIRECTORY include/felspar DESTINATION include)

if(TARGET felspar-examples)
    add_subdirectory(examples)
endif()

if(TARGET felspar-check)
    add_subdirectory(test)
endif()