Skip to content

Commit f93d4d7

Browse files
committed
spdlog: Use system library if found
1 parent fd459f2 commit f93d4d7

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ else()
7878
endif()
7979
add_definitions(-DLOADER_VERSION_SHA="${VERSION_SHA}")
8080

81-
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/third_party/spdlog_headers")
81+
find_package(spdlog CONFIG)
82+
if(NOT spdlog_FOUND)
83+
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/third_party/spdlog_headers")
84+
endif()
8285

8386
# Update other relevant variables to include the patch
8487
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")

source/utils/CMakeLists.txt

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Copyright (C) 2024 Intel Corporation
22
# SPDX-License-Identifier: MIT
33

4-
add_library(utils
5-
STATIC
6-
"logging.h"
7-
"logging.cpp"
8-
)
4+
set(logging_SOURCES logging.h logging.cpp)
5+
6+
if(NOT spdlog_FOUND)
7+
add_library(utils STATIC ${logging_SOURCES})
8+
target_include_directories(utils PRIVATE ${CMAKE_SOURCE_DIR}/third_party/spdlog_headers/)
9+
else()
10+
add_library(utils ${logging_SOURCES})
11+
target_link_libraries(utils spdlog::spdlog)
12+
endif()
913

10-
target_include_directories(utils PRIVATE ${CMAKE_SOURCE_DIR}/third_party/spdlog_headers/)

0 commit comments

Comments
 (0)