85 lines
2.5 KiB
CMake
85 lines
2.5 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
|
|
# set(CMAKE_BUILD_TYPE Release)
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
|
|
|
|
|
find_package(ASIO QUIET)
|
|
if (ASIO_FOUND)
|
|
message(STATUS "ASIO library was found in the host system")
|
|
else()
|
|
message(STATUS "ASIO library was not found! Try to download it!")
|
|
|
|
include(FetchContent)
|
|
include(ExternalProject)
|
|
|
|
FetchContent_Declare(asio_lib
|
|
SOURCE_DIR ${CMAKE_BINARY_DIR}/asio_lib
|
|
BINARY_DIR ${CMAKE_BINARY_DIR}
|
|
GIT_REPOSITORY "https://github.com/chriskohlhoff/asio"
|
|
GIT_TAG "asio-1-32-0"
|
|
GIT_SHALLOW TRUE
|
|
GIT_SUBMODULES ""
|
|
GIT_PROGRESS TRUE
|
|
)
|
|
FetchContent_MakeAvailable(asio_lib)
|
|
# FetchContent_GetProperties(asio_lib SOURCE_DIR asio_SOURCE_DIR)
|
|
|
|
set(ASIO_INSTALL_DIR ${CMAKE_BINARY_DIR}/asio_lib/asio)
|
|
find_package(ASIO)
|
|
endif()
|
|
|
|
find_package(cxxopts QUIET CONFIG)
|
|
if (cxxopts_FOUND)
|
|
message(STATUS "CXXOPTS library was found in the host system")
|
|
else()
|
|
message(STATUS "CXXOPTS library was not found! Try to download it!")
|
|
|
|
include(FetchContent)
|
|
include(ExternalProject)
|
|
|
|
FetchContent_Declare(cxxopts_lib
|
|
SOURCE_DIR ${CMAKE_BINARY_DIR}/cxxopts_lib
|
|
BINARY_DIR ${CMAKE_BINARY_DIR}
|
|
GIT_REPOSITORY "https://github.com/jarro2783/cxxopts.git"
|
|
GIT_TAG "v3.3.1"
|
|
GIT_SHALLOW TRUE
|
|
GIT_SUBMODULES ""
|
|
GIT_PROGRESS TRUE
|
|
)
|
|
FetchContent_MakeAvailable(cxxopts_lib)
|
|
endif()
|
|
|
|
set(ASIBFM700_LIB_SRC asibfm700_common.h asibfm700_servocontroller.h asibfm700_servocontroller.cpp)
|
|
|
|
set(ASIBFM700_LIB asibfm700mount)
|
|
add_library(${ASIBFM700_LIB} STATIC ${ASIBFM700_LIB_SRC}
|
|
asibfm700_mount.h asibfm700_mount.cpp
|
|
asibfm700_configfile.h
|
|
asibfm700_netserver.cpp
|
|
asibfm700_netserver.h
|
|
)
|
|
|
|
target_include_directories(${ASIBFM700_LIB} PUBLIC mcc spdlog ${ERFA_INCLUDE_DIR})
|
|
target_link_libraries(${ASIBFM700_LIB} mcc spdlog ${ERFA_LIBFILE})
|
|
|
|
|
|
set(ASIBFM700_NETSERVER_APP asibfm700_netserver)
|
|
add_executable(${ASIBFM700_NETSERVER_APP} asibfm700_netserver_main.cpp)
|
|
# target_include_directories(${ASIBFM700_NETSERVER_APP} PRIVATE mcc spdlog)
|
|
target_link_libraries(${ASIBFM700_NETSERVER_APP} PRIVATE mcc spdlog ${ASIBFM700_LIB})
|
|
|
|
option(WITH_TESTS "Build tests" ON)
|
|
|
|
if (WITH_TESTS)
|
|
set(CFG_TEST_APP cfg_test)
|
|
add_executable(${CFG_TEST_APP} tests/cfg_test.cpp)
|
|
target_link_libraries(${CFG_TEST_APP} PRIVATE mcc)
|
|
|
|
enable_testing()
|
|
endif()
|