1
0
Fork 0
mirror of https://gitlab.com/niansa/libcrosscoro.git synced 2025-03-06 20:53:32 +01:00

Minor cleanups and finished rename

This commit is contained in:
Nils 2021-07-28 12:08:13 +02:00
parent e955a33c16
commit 8dbad30d2c
2 changed files with 24 additions and 15 deletions

View file

@ -1,18 +1,11 @@
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}
)
project(libcrosscoro CXX)
set(CARES_STATIC ON CACHE INTERNAL "")
set(CARES_SHARED OFF CACHE INTERNAL "")
set(CARES_INSTALL OFF CACHE INTERNAL "")
set(LIBCORO_SOURCE_FILES
set(LIBCROSSCORO_SOURCE_FILES
inc/coro/concepts/awaitable.hpp
inc/coro/concepts/buffer.hpp
inc/coro/concepts/executor.hpp
@ -39,18 +32,18 @@ set(LIBCORO_SOURCE_FILES
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)
add_library(crosscoro STATIC ${LIBCROSSCORO_SOURCE_FILES})
set_target_properties(crosscoro PROPERTIES LINKER_LANGUAGE CXX)
target_compile_features(crosscoro PUBLIC cxx_std_20)
target_include_directories(crosscoro PUBLIC inc)
target_link_libraries(crosscoro 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)
target_compile_options(crosscoro PUBLIC -fcoroutines -Wall -Wextra -pipe)
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
message(FATAL_ERROR "Clang is currently not supported.")
endif()

View file

@ -1,2 +1,18 @@
# libcrosscoro C++20 cross-platform coroutine library
Based on https://github.com/jbaldwin/libcoro but cross-platform
## Use in your CMake project
cmake_minimum_required(VERSION 3.11)
# Fetch the project and make it available for use.
include(FetchContent)
FetchContent_Declare(
libcrosscoro
GIT_REPOSITORY https://gitlab.com/niansa/libcrosscoro.git
GIT_TAG <TAG_OR_GIT_HASH>
)
FetchContent_MakeAvailable(libcoro)
# Link the libcoro cmake target to your project(s).
target_link_libraries(${PROJECT_NAME} PUBLIC libcrosscoro)