Skip to content

Commit

Permalink
Use spdlog on system if available (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymd-stella authored Sep 18, 2023
1 parent 2449abc commit 9f31886
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,13 @@ include_directories(${EIGEN3_INCLUDE_DIR})
find_package(yaml-cpp REQUIRED)

# spdlog
set(spdlog_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/3rd/spdlog/include)
include_directories(${spdlog_INCLUDE_DIR})
find_package(spdlog QUIET)
if(spdlog_FOUND)
message(STATUS "Use spdlog on system: ${spdlog_VERSION}")
else()
set(spdlog_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/3rd/spdlog/include)
include_directories(${spdlog_INCLUDE_DIR})
endif()

# filesystem
set(filesystem_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/3rd/filesystem/include)
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ foreach(EXECUTABLE_TARGET IN LISTS EXECUTABLE_TARGETS)
target_link_libraries(${EXECUTABLE_TARGET} PRIVATE
yaml-cpp)

if(spdlog_FOUND)
target_link_libraries(${EXECUTABLE_TARGET} PRIVATE
spdlog::spdlog)
endif()
endforeach()

0 comments on commit 9f31886

Please sign in to comment.