From 55d8d359b4f623662d20a6dd0f2a0aac0632b4a9 Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Thu, 6 Feb 2025 18:02:43 +0300 Subject: [PATCH] ... --- cxx/CMakeLists.txt | 20 +++++++++++++------- cxx/control_proto.h | 3 +-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/cxx/CMakeLists.txt b/cxx/CMakeLists.txt index 3124a70..fe48d9f 100644 --- a/cxx/CMakeLists.txt +++ b/cxx/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.14) +# set(CMAKE_BUILD_TYPE Release) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -36,15 +38,18 @@ find_package(spdlog CONFIG) # set(SPDLOG_MASTER_PROJECT OFF) # set(SPDLOG_BUILD_EXAMPLE OFF) -set(spdlog_FOUND FALSE ) +# set(spdlog_FOUND FALSE ) if (NOT spdlog_FOUND) message(STATUS "SPDLOG libarary was not found! Try to download it!") include(FetchContent) include(ExternalProject) - # FetchContent_Declare(spdlog - ExternalProject_Add(spdlog + set(SPDLOG_USE_STD_FORMAT ON CACHE INTERNAL "Use of C++20 std::format") + set(SPDLOG_FMT_EXTERNAL OFF CACHE INTERNAL "Turn off external fmt library") + + FetchContent_Declare(spdlog + # ExternalProject_Add(spdlog # SOURCE_DIR ${CMAKE_BINARY_DIR}/spdlog_lib # BINARY_DIR ${CMAKE_BINARY_DIR}/spdlog_lib/build GIT_REPOSITORY "https://github.com/gabime/spdlog.git" @@ -55,13 +60,14 @@ if (NOT spdlog_FOUND) CMAKE_ARGS "-DSPDLOG_USE_STD_FORMAT=ON -DSPDLOG_FMT_EXTERNAL=OFF" # CONFIGURE_COMMAND "" # BUILD_COMMAND "" - INSTALL_COMMAND "" + # INSTALL_COMMAND "" # UPDATE_COMMAND "" - # SOURCE_SUBDIR cmake + # SOURCE_SUBDIR cmake # turn off building + OVERRIDE_FIND_PACKAGE ) # FetchContent_MakeAvailable(spdlog) # FetchContent_GetProperties(spdlog_lib SOURCE_DIR spdlog_SOURCE_DIR) - # find_package(spdlog REQUIRED) + find_package(spdlog CONFIG) endif() option(WITH_TESTS "Build tests" ON) @@ -84,5 +90,5 @@ add_library(${CNTR_PROTO_LIB} STATIC ${CNTR_PROTO_LIB_SRC}) if (WITH_TESTS) set(CNTR_PROTO_TEST_APP cntr_proto_test) add_executable(${CNTR_PROTO_TEST_APP} tests/cntr_proto_test.cpp) - target_link_libraries(${CNTR_PROTO_TEST_APP} ${CNTR_PROTO_LIB}) + target_link_libraries(${CNTR_PROTO_TEST_APP} ${CNTR_PROTO_LIB} spdlog::spdlog_header_only) endif() diff --git a/cxx/control_proto.h b/cxx/control_proto.h index b752e16..9b20705 100644 --- a/cxx/control_proto.h +++ b/cxx/control_proto.h @@ -77,8 +77,7 @@ static constexpr std::array CONTROL_PROTO_VALID_COMMAND = { CONTROL_PROTO_STR_SLEW_YVEL, CONTROL_PROTO_STR_TRACK_XVEL, CONTROL_PROTO_STR_TRACK_YVEL, CONTROL_PROTO_STR_STOP, CONTROL_PROTO_STR_SITE_LON, CONTROL_PROTO_STR_SITE_LAT, CONTROL_PROTO_STR_SITE_ELEV, CONTROL_PROTO_STR_METEO_TEMP, CONTROL_PROTO_STR_METEO_PRES, - CONTROL_PROTO_STR_METEO_HUM, CONTROL_PROTO_STR_NET_CONF, -}; + CONTROL_PROTO_STR_METEO_HUM, CONTROL_PROTO_STR_NET_CONF}; class ControlProtoParser {