cmake_minimum_required(VERSION 3.0) project(libcoro CXX) # Set the githooks directory to auto format and update the readme. message("${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR} -> git config --local core.hooksPath .githooks") execute_process( COMMAND git config --local core.hooksPath .githooks WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) set(CARES_STATIC ON CACHE INTERNAL "") set(CARES_SHARED OFF CACHE INTERNAL "") set(CARES_INSTALL OFF CACHE INTERNAL "") set(LIBCORO_SOURCE_FILES inc/coro/concepts/awaitable.hpp inc/coro/concepts/buffer.hpp inc/coro/concepts/executor.hpp inc/coro/concepts/promise.hpp inc/coro/concepts/range_of.hpp inc/coro/detail/void_value.hpp inc/coro/coro.hpp inc/coro/event.hpp src/event.cpp inc/coro/fd.hpp inc/coro/generator.hpp inc/coro/latch.hpp inc/coro/mutex.hpp src/mutex.cpp inc/coro/poll.hpp inc/coro/ring_buffer.hpp inc/coro/semaphore.hpp src/semaphore.cpp inc/coro/shared_mutex.hpp inc/coro/stop_signal.hpp inc/coro/sync_wait.hpp src/sync_wait.cpp inc/coro/task_container.hpp inc/coro/task.hpp inc/coro/thread_pool.hpp src/thread_pool.cpp inc/coro/when_all.hpp ) add_library(${PROJECT_NAME} STATIC ${LIBCORO_SOURCE_FILES}) set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) target_include_directories(${PROJECT_NAME} PUBLIC inc) target_link_libraries(${PROJECT_NAME} PUBLIC pthread c-ares ssl crypto) if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.2.0") message(FATAL_ERROR "gcc version ${CMAKE_CXX_COMPILER_VERSION} is unsupported, please upgrade to at least 10.2.0") endif() target_compile_options(${PROJECT_NAME} PUBLIC -fcoroutines -Wall -Wextra -pipe) elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") message(FATAL_ERROR "Clang is currently not supported.") endif()