CMakeLists.txt (1684B)
1 cmake_minimum_required(VERSION 3.28.1) 2 project(matrix_coro) 3 4 set(CMAKE_CXX_STANDARD 23) 5 6 add_library(matrix_coro SHARED src/matrix_coro.cpp) 7 set_property(TARGET matrix_coro PROPERTY COMPILE_WARNING_AS_ERROR ON) 8 9 Include(FetchContent) 10 11 FetchContent_Declare( 12 cppcoro 13 GIT_REPOSITORY https://github.com/andreasbuhr/cppcoro.git 14 GIT_TAG a4ef65281814b18fdd1ac5457d3e219347ec6cb8 15 GIT_SHALLOW ON 16 GIT_PROGRESS ON 17 SYSTEM 18 ) 19 20 FetchContent_MakeAvailable(cppcoro) 21 22 # Include curl 23 find_package(CURL REQUIRED) 24 25 # Include jsoncpp 26 find_package(PkgConfig REQUIRED) 27 pkg_check_modules(JSONCPP jsoncpp IMPORTED_TARGET GLOBAL) 28 29 if (NOT TARGET spdlog) 30 find_package(spdlog REQUIRED) 31 endif () 32 33 # include cthash using fetch content 34 FetchContent_Declare( 35 cthash 36 GIT_REPOSITORY https://github.com/hanickadot/cthash.git 37 GIT_TAG 52ed741c82c518f7c038c50d5f39bf943067d9a8 38 GIT_SHALLOW ON 39 GIT_PROGRESS ON 40 SYSTEM 41 ) 42 43 FetchContent_MakeAvailable(cthash) 44 45 target_link_libraries( 46 matrix_coro 47 spdlog::spdlog 48 PkgConfig::JSONCPP 49 CURL::libcurl 50 cppcoro 51 cthash 52 ) 53 54 target_include_directories(matrix_coro 55 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include 56 ) 57 58 if (CMAKE_BUILD_TYPE MATCHES "Debug") 59 set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 60 set(CMAKE_CXX_CLANG_TIDY "clang-tidy") 61 62 set( 63 CMAKE_CXX_FLAGS 64 "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fsanitize=address" 65 ) 66 target_link_options(matrix_coro 67 BEFORE PUBLIC -fsanitize=undefined PUBLIC -fsanitize=address 68 ) 69 endif () 70 71 # Examples 72 add_subdirectory(examples) 73 74 add_subdirectory(tests)