Skip to content

Commit

Permalink
spdlog: Use system library if found
Browse files Browse the repository at this point in the history
  • Loading branch information
frantisekz committed Jun 10, 2024
1 parent fd459f2 commit 4b5080c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ else()
endif()
add_definitions(-DLOADER_VERSION_SHA="${VERSION_SHA}")

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/third_party/spdlog_headers")
find_package(spdlog CONFIG)
if(NOT spdlog_FOUND)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/third_party/spdlog_headers")
endif()

# Update other relevant variables to include the patch
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
Expand Down
16 changes: 10 additions & 6 deletions source/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: MIT

add_library(utils
STATIC
"logging.h"
"logging.cpp"
)
set(logging_files logging.h logging.cpp)

if(NOT spdlog_FOUND)
add_library(utils STATIC ${logging_files})
target_include_directories(utils PRIVATE ${CMAKE_SOURCE_DIR}/third_party/spdlog_headers/)
else()
add_library(utils ${logging_files})
target_link_libraries(utils PRIVATE spdlog::spdlog)
set_property(TARGET utils PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()

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

0 comments on commit 4b5080c

Please sign in to comment.