Skip to content

Commit

Permalink
Support installing spdlog through CPM (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui authored Jun 15, 2022
1 parent bce505c commit 6dc9fe3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ endif ()
set(CMAKE_VERBOSE_MAKEFILE ${VERBOSE})
set(CMAKE_CXX_EXTENSIONS OFF) # without compiler extensions like gnu++11
if (CPM_USE_LOCAL_PACKAGES)
set(CPM_SUPPORTED_LIBS LibArchive Libgit2 fmt)
set(CPM_SUPPORTED_LIBS LibArchive Libgit2 fmt spdlog)
message(STATUS "CPM_USE_LOCAL_PACKAGES is set as ON; `${CPM_SUPPORTED_LIBS}` on local will be used if found.")
endif ()

Expand Down
17 changes: 10 additions & 7 deletions cmake/AddSpdlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ include_guard(GLOBAL)
message(CHECK_START "Adding Spdlog")
list(APPEND CMAKE_MESSAGE_INDENT " ")

FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG v1.10.0
)
include(cmake/CPM.cmake)

set(SPDLOG_FMT_EXTERNAL ON)
if (CMAKE_BUILD_TYPE STREQUAL Release) # -DCMAKE_BUILD_TYPE=Release
set(SPDLOG_BUILD_SHARED OFF)
else ()
set(SPDLOG_BUILD_SHARED ON)
endif ()
FetchContent_MakeAvailable(spdlog)
CPMAddPackage(
NAME spdlog
GITHUB_REPOSITORY gabime/spdlog
VERSION 1.10.0
GIT_TAG v1.10.0
OPTIONS
"SPDLOG_FMT_EXTERNAL ON"
"SPDLOG_BUILD_SHARED ${SPDLOG_BUILD_SHARED}"
)

list(APPEND POAC_DEPENDENCIES spdlog::spdlog)
message(CHECK_PASS "added")
Expand Down

0 comments on commit 6dc9fe3

Please sign in to comment.