Skip to content

Instantly share code, notes, and snippets.

@EvanLyu732
Created October 17, 2022 07:52
Show Gist options
  • Save EvanLyu732/24bac0aa21a05b1275bb18f1d928abaf to your computer and use it in GitHub Desktop.
Save EvanLyu732/24bac0aa21a05b1275bb18f1d928abaf to your computer and use it in GitHub Desktop.
spdlog.hpp.in corresponding cmake macro
# Parameter:
# LOG MODULE: folder name
# BIND_PORT: network sinker register port
# SEND_PORT: network sinker publish port
macro(enable_logging LOG_MODULE BIND_PORT SEND_PORT)
if(NOT spdlog_FOUND)
find_package(spdlog REQUIRED)
endif()
if(NOT Boost_FOUND)
find_package(Boost REQUIRED COMPONENTS system)
endif()
set(LOG_MODULE LOG_MODULE)
set(BIND_PORT BIND_PORT)
set(SEND_PORT SEND_PORT)
# replace this line with your spdlog.hpp.in location. example
configure_file(${CMAKE_SOURCE_DIR}/include/spdlog.hpp.in ${CMAKE_SOURCE_DIR}/include/spdlog.hpp @ONLY)
endmacro()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment