61 lines
2.0 KiB
CMake
61 lines
2.0 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
project(Ranczo-IO)
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# add_compile_options(-g -fsanitize=address,undefined,float-divide-by-zero,float-cast-overflow,null -fsanitize-address-use-after-scope -fno-sanitize-recover=all -fno-sanitize=alignment -fno-omit-frame-pointer)
|
|
# add_link_options(-g -fsanitize=address,undefined,float-divide-by-zero,float-cast-overflow,null -fsanitize-address-use-after-scope -fno-sanitize-recover=all -fno-sanitize=alignment -fno-omit-frame-pointer)
|
|
|
|
include(CheckIPOSupported)
|
|
check_ipo_supported(RESULT supported OUTPUT error)
|
|
|
|
if( supported )
|
|
message(STATUS "IPO / LTO enabled")
|
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
else()
|
|
message(STATUS "IPO / LTO not supported: <${error}>")
|
|
endif()
|
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
include(FetchContent)
|
|
|
|
set(BOOST_INCLUDE_LIBRARIES asio assert core endian json mqtt5 fusion optional random range smart_ptr spirit type_traits)
|
|
set(BOOST_ENABLE_CMAKE ON)
|
|
set(Boost_NO_SYSTEM_PATHS ON)
|
|
set(BOOST_ROOT /usr/local/boost-1.89)
|
|
|
|
find_package(Boost 1.89 REQUIRED COMPONENTS json mqtt5)
|
|
# spdlog
|
|
set(SPDLOG_USE_STD_FORMAT OFF)
|
|
FetchContent_Declare(
|
|
spdlog
|
|
GIT_REPOSITORY https://github.com/gabime/spdlog
|
|
GIT_TAG v1.14.1
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
FetchContent_Declare(
|
|
tl_expected
|
|
GIT_REPOSITORY https://github.com/TartanLlama/expected.git
|
|
GIT_TAG v1.1.0
|
|
)
|
|
FetchContent_MakeAvailable(tl_expected)
|
|
|
|
# c++20 format library, super usefull, super fast
|
|
set(FMT_TEST OFF CACHE INTERNAL "disabling fmt tests")
|
|
set(FMT_FUZZ OFF CACHE INTERNAL "disabling fmt fuzz")
|
|
FetchContent_Declare(fmt
|
|
URL https://github.com/fmtlib/fmt/archive/refs/tags/10.2.1.zip
|
|
URL_MD5 1bba4e8bdd7b0fa98f207559ffa380a3
|
|
)
|
|
FetchContent_MakeAvailable(fmt spdlog tl_expected)
|
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
# add_compile_definitions(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
|
|
|
|
add_subdirectory(libs)
|
|
add_subdirectory(services)
|
|
add_subdirectory(tests)
|