diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cdfaab..6316a87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d393d63..a5266b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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()