Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
7e95963
Useless cast
vnepogodin Dec 19, 2021
f81cb9f
Revert "Useless cast"
vnepogodin Dec 19, 2021
f096c61
🔥 conditional_cast
vnepogodin Dec 19, 2021
a087dee
🚧 fix building with c++11
vnepogodin Dec 19, 2021
cc30229
Merge pull request #2216 from vnepogodin/patch-1
gabime Dec 19, 2021
626efad
spdlog: fmt - support `std::span` in `to_hex`
timblechmann Dec 30, 2021
32fedcf
Merge pull request #2228 from timblechmann/feature/to_hex_span_fix
gabime Dec 30, 2021
3540ba3
Reset current size if rotated files on open
SpriteOvO Jan 4, 2022
729d7f6
Merge pull request #2234 from SpriteOvO/v1.x
gabime Jan 5, 2022
2a4c34b
Allow forward-declaration of level_enum
daverigby Jan 11, 2022
4cfdc8c
Merge pull request #2245 from daverigby/level_enum_fwd
gabime Jan 11, 2022
eab522e
Now only getting the date if formater needs to display date related i…
doug1234 Jan 14, 2022
5568b16
Resetting the needs time flag when setting a pattern.
doug1234 Jan 14, 2022
d9ec02d
Fix mistake in previous checkin.
doug1234 Jan 15, 2022
584d772
Several minor improvements based on code review suggestions.
doug1234 Jan 15, 2022
28b9adf
Added the last few suggested changes.
doug1234 Jan 15, 2022
caa0e54
Merge pull request #2246 from doug1234/DontGetTheDate
gabime Jan 16, 2022
2382c87
Update pattern_formatter-inl.h
gabime Jan 16, 2022
666bec5
removed unneeded spaces
PixelParas Jan 17, 2022
93f59d0
Merge pull request #2249 from PixelParas/patch-1
gabime Jan 17, 2022
792d618
added a few missing files/directories to the gitignore
LeonBrands Jan 23, 2022
8fb1121
Merge pull request #2255 from LeonBrands/patch-1
gabime Jan 23, 2022
5afff78
throw if flush failed
Feb 5, 2022
7536192
Fix #2261
Feb 5, 2022
ec8b0be
comment
Feb 5, 2022
5b03dc1
Throw if rotating_file_sink constructor receives max_size==0 as arg
Feb 5, 2022
0b48976
flush before rotating
Feb 5, 2022
d497f49
Apply pattern width to one of the source information fields while mis…
kyuheon-kr Feb 8, 2022
b7836c3
Merge pull request #2269 from kyuheon-kr/fix-issue-2201
gabime Feb 8, 2022
d8199b6
Bump fmt to version 8.1.1 and run clang-format
Feb 12, 2022
c432fdd
Bump fmt to version 8.1.1 and run clang-format
Feb 12, 2022
71105e0
Fixed #2227
Feb 12, 2022
53c9b70
Fix #2211
Feb 12, 2022
4cea9b8
Limit max number of rotating files to 200000. Fix #1905
Feb 12, 2022
4c2ce2c
Update rotating_file_sink-inl.h
gabime Feb 13, 2022
a732a0d
Limit max number of rotating files to 200000, not max size
surfycui Feb 14, 2022
f2461f1
Merge pull request #2273 from surfycui/v1.x
gabime Feb 14, 2022
9cd9c98
pattern_formatter-inl: fix reorder-ctor warning
adriweb Feb 15, 2022
2f2d04b
Merge pull request #2278 from adriweb/patch-1
gabime Feb 15, 2022
69cac81
When built with SPDLOG_FMT_EXTERNAL_HO consumers of the spdlog target…
adamcalhoon Mar 6, 2022
7f8a61e
Merge pull request #2300 from adamcalhoon/fix-fmt-external-ho-deps
gabime Mar 6, 2022
5ee969e
Fix fopen_s error reporting with PREVENT_CHILD_FD
nUl1 Mar 11, 2022
b1478d9
Merge pull request #2305 from nUl1/fix-fopens
gabime Mar 11, 2022
52dc210
Fixed compiler error when building on Windows with #define UNICODE
risa2000 Mar 22, 2022
a49456f
Merge pull request #2317 from risa2000/patch-1
gabime Mar 24, 2022
3c1ee54
Add option to enable formatting of systemd sink
Delgan Mar 27, 2022
c1aeefb
fixup! Add option to enable formatting of systemd sink
Delgan Mar 29, 2022
083ea59
Merge pull request #2324 from Delgan/GH-2320-add-systemd-formatter
gabime Mar 29, 2022
36b4b9d
Add optional "ident" argument to systemd sink constructor
Delgan Apr 1, 2022
fc51c09
Merge pull request #2328 from Delgan/GH-2323-add-systemd-identifier
gabime Apr 2, 2022
757e9f8
Bump version to 1.10.0
Apr 4, 2022
76fb40d
clang format
Apr 4, 2022
184fae0
clean code, clean up the warning
Apr 10, 2022
e6265c0
Make file_event_handlers an aggregate
espkk Apr 14, 2022
4ccbb5a
Merge pull request #2342 from espkk/v1.x
gabime Apr 15, 2022
78fbc69
Merge pull request #2336 from aengusjiang/v1.x
gabime Apr 21, 2022
b3ce5ed
Remove comment
gabime Apr 21, 2022
ebeb370
Switch to vformat_to
sylveon Apr 22, 2022
3cf9496
Add missing include
sylveon Apr 22, 2022
91019f4
Fix bad #ifdef
sylveon Apr 22, 2022
56adf64
Actually fix bad #ifdef
sylveon Apr 22, 2022
c203b4d
Fix conversion from fmt::memory_buffer to fmt::string_view
sylveon Apr 22, 2022
ee00f2e
Remove fmt_helper.h include from logger.h
sylveon Apr 23, 2022
714cf12
Add fmt_helper.h include to includes.h and os-inl.h
sylveon Apr 23, 2022
37dd6bb
Address PR review comments
sylveon Apr 26, 2022
cd4f6c1
Replace fmt_helper::to_string by a macro
sylveon Apr 27, 2022
8338a48
Remove fmt_helper::to_string
sylveon Apr 27, 2022
b299855
Merge pull request #2346 from sylveon/v1.x
gabime Apr 27, 2022
173d065
Fixed move in ringnuffer_sink
gabime Apr 27, 2022
0a875d7
use __android_log_write or __android_log_buf_write based on template …
tiolan May 6, 2022
2eedf1f
remove usage of forward args
tiolan May 6, 2022
a934701
Merge pull request #2358 from tiolan/topic/android_buffer_v1_x
gabime May 6, 2022
ece9621
fix clone async test
stkw0 May 7, 2022
bd0198d
Merge pull request #2364 from stkw0/v1.x
gabime May 7, 2022
38929f8
Allow overriding need_localtime for custom formatter
conr2d May 7, 2022
c03c925
Copy the value of need_localtime when cloning pattern_formatter
conr2d May 7, 2022
aa7490d
Set eol to the test for overriding need_localtime
conr2d May 7, 2022
9b4b373
Merge pull request #2365 from conr2d/feature/need_localtime
gabime May 7, 2022
6d587f5
Use fmt::detail::vformat_to(buf, ...) since it is ~20ns faster than f…
May 8, 2022
128cbe5
clang-format
May 8, 2022
5f5e70e
C++14 build fixes for older gcc #2333
kslattery May 11, 2022
d3dee23
Remove new macro, update example with correct way to specify fmt lib …
May 12, 2022
d89a1e6
Add default file-event_handler callbacks. #2374
May 13, 2022
41efc97
build: expand SOVERSION to not give false illusion of compatibility
jengelh May 13, 2022
e05b854
Merge pull request #2375 from kslattery/bugfix/default_file_event_han…
gabime May 13, 2022
0ef5228
Merge pull request #2372 from kslattery/v1.x
gabime May 13, 2022
e36b69a
Merge pull request #2376 from jengelh/master
gabime May 13, 2022
0d8197c
Update common.h
gabime May 13, 2022
afb6907
Allow absolute CMAKE_INSTALL_LIBDIR
alexshpilkin May 19, 2022
876880f
Reflect CMAKE_INSTALL_INCLUDEDIR in pkg-config
alexshpilkin May 19, 2022
3d7ee64
fix error: cannot bind lvale to right reference
aengusjiang May 19, 2022
799802f
Add FMT_STRING to allow compilation with FMT_ENFORCE_COMPILE_STRING
john4744 May 18, 2022
d546201
Merge pull request #2381 from Esri/john4744/android_fmt_compile_time_…
gabime May 19, 2022
ffd929c
Merge pull request #2383 from alexshpilkin/fix-pkg-config
gabime May 19, 2022
fc93ddb
Merge pull request #2384 from aengusjiang/v1.x
gabime May 19, 2022
1f0c2f9
Remove try_lock from null_mutex.
panzhongxian May 20, 2022
9e8e52c
Merge pull request #2385 from panzhongxian/v1.x
gabime May 20, 2022
1eafcfa
Romove the empty file if no log in first period in hourly logger
panzhongxian May 24, 2022
beefee7
Remove redundant std::move at return (triggers -Wredundant-move in Gc…
polesapart Jun 2, 2022
298a200
Merge pull request #2396 from polesapart/v1.x
gabime Jun 2, 2022
822f972
update
bergen4 Jun 9, 2022
1f608a8
add overrun reset function
bergen4 Jun 9, 2022
ca747c7
Set c++20 when SPDLOG_USE_STD_FORMAT option is turned on
cookcocck Jun 14, 2022
0331585
Merge pull request #2386 from panzhongxian/v1.x
gabime Jun 18, 2022
866fdaa
Merge pull request #2399 from bergen4/v1.x
gabime Jun 18, 2022
a26e174
Merge pull request #2402 from cookcocck/fix_cmake_spdlog_use_std_format
gabime Jun 18, 2022
ab7b325
Update README.md
gabime Jun 24, 2022
68f42a5
test_stopwatch: fix on mingw
neheb Jun 24, 2022
d7690d8
Merge pull request #2415 from neheb/mingw
gabime Jun 26, 2022
6c95f4c
Fix #2419 by documenting the set_pattern behaviour
gabime Jul 1, 2022
dfe1009
Expend support for any std::chrono::duration in `spdlog::flush_every`
LucasChollet Jul 17, 2022
8348406
Merge pull request #2439 from LucasChollet/duration
gabime Jul 17, 2022
5f8877b
Explicitly casting level_enum to size_t.
ibmibmibm Jul 21, 2022
7d805c2
Merge pull request #2443 from ibmibmibm/v1.x
gabime Jul 22, 2022
fb3ddf7
Removed doc "(shared not supported in windows yet)"
Jul 25, 2022
6187923
Merge pull request #2445 from Hish15/Hish15/CorrectDoc
gabime Jul 25, 2022
26f69ee
Re-introduce redundant std::move at return for old GCC (before versio…
Simon-Janos Jul 27, 2022
b75edfa
Merge pull request #2449 from Simon-Janos/Re-introduce-redundant-std-…
gabime Jul 27, 2022
afb1699
Add openSUSE installation
LorenDB Aug 12, 2022
64e0724
Merge pull request #2468 from LorenDB/patch-1
gabime Aug 12, 2022
f44fa31
Fix #2434
gabime Aug 17, 2022
de67ebd
cmake: set(CMAKE_POSITION_INDEPENDENT_CODE ON) for Linux static libra…
Sep 2, 2022
57e5814
SPDLOG_NO_SOURCE_LOC support for omitting __FILE__, __LINE__ and SPDL…
Oct 14, 2021
34f88d4
cmake: SPDLOG_BUILD_PIC opt-in for CMAKE_POSITION_INDEPENDENT_CODE
nigels-com Sep 3, 2022
1eaf98c
SPDLOG_NO_SOURCE_LOC implementation refinement
nigels-com Sep 3, 2022
b605127
Merge pull request #2476 from nigels-com/SPDLOG_NO_SOURCE_LOC
gabime Sep 7, 2022
81de01c
Merge pull request #2475 from nigels-com/-fPIC
gabime Sep 7, 2022
5ca5fdf
Use lower-case "windows.h" for case-sensitive file systems
panicgh Sep 26, 2022
7130676
Merge pull request #2495 from panicgh/lowercase-windows-h
gabime Sep 26, 2022
b8fdc9b
Workaround GCC 12 warning
offa Sep 28, 2022
06f9953
Workaround deprecation warning on Clang with C++20
offa Sep 29, 2022
523a075
Merge pull request #2499 from offa/clang_cpp20_workaround
gabime Sep 29, 2022
29b24f9
Use pragams instead of compile options
offa Sep 30, 2022
7fa59cf
Merge pull request #2498 from offa/gcc12_workaround
gabime Sep 30, 2022
23fce5f
Migrate to Github Actions CI
offa Sep 29, 2022
ec81b32
Remove .travis.yml
offa Sep 29, 2022
cf6cdc5
Replace Travis CI Badge with Github Actions
offa Oct 3, 2022
936697e
Merge pull request #2500 from offa/ghactions_ci
gabime Oct 3, 2022
93b9132
Replace iterator difference with std::distance
kin4stat Oct 13, 2022
d011332
Merge pull request #2509 from kin4stat/v1.x
gabime Oct 14, 2022
7768c62
Export targets to build directory so that it can be found at configur…
puneetmatharu Oct 17, 2022
f3b61c7
Catch exception by reference to fix -Wcatch-value warning
Oct 17, 2022
0145223
Add numerical level to Mongo sink for easier queries
Oct 17, 2022
a3c47cc
Don't force Mongo sink to own MongoCXX instance
Oct 17, 2022
77429b2
Merge pull request #2515 from puneetmatharu/v1.x
gabime Oct 18, 2022
1bb1f05
Adjust MongoCXX instance handling in mongo_sink
Oct 19, 2022
5f67ef4
Remove pointless try block in mongo_sink
Oct 19, 2022
0674e79
Improve arg passing and exceptions in mongo_sink
Oct 19, 2022
b5d361f
clang-format mongo_sink.h
Oct 19, 2022
5fba286
Change mongocxx::exception handler to std::exception
Oct 19, 2022
bced424
Merge pull request #2519 from sandorzm/v1.x
gabime Oct 19, 2022
3c0e036
Use 'SPDLOG_FMT_RUNTIME' to fix compilation error throwed MSVC and fm…
YunchengLiu Oct 19, 2022
3499dfe
Bump bundled fmtlib to version 1.9.1
Oct 31, 2022
8a0b223
Renamed bench name
Oct 31, 2022
867df8c
Update appveyor.yml
gabime Oct 31, 2022
a474337
Update appveyor.yml
gabime Oct 31, 2022
9125bda
suppress "integral constant overflow" warning under msvc 2017
Oct 31, 2022
7147da4
Merge branch 'v1.x' of https://github.com/gabime/spdlog into v1.x
Oct 31, 2022
070dd18
clang format
Oct 31, 2022
a7e2bf1
Update user defined type example
Oct 31, 2022
14a29c0
suppress warning 4307 when including format-inline.h under msvc 2017
Oct 31, 2022
31d6935
updated readme
Oct 31, 2022
130ff0c
enable the ostream formatting for backward compatibility with fmt 8.x
Oct 31, 2022
c627c66
Replace fmt::detail::vformat_to(buf,..) with fmt::vformat_to(fmt::a…
Oct 31, 2022
6c975fa
Replace fmt::detail::vformat_to(buf,..) with fmt::vformat_to(fmt::a…
Oct 31, 2022
b59b4a2
Rvert suppressing msvc2017 warnings and fix ci instead
Oct 31, 2022
fdb1f59
Fix fmt::vformat_to when SPDLOG_WCHAR_TO_UTF8_SUPPORT is defined
Oct 31, 2022
fbba6df
Fix #2431
Oct 31, 2022
678a79c
Fixed syntax error from prev commit
Oct 31, 2022
4d7308f
Fixed msvc warning C4800 in win_eventlog_sink
Oct 31, 2022
4accce5
Try again fixing fmt::vformat_to when SPDLOG_WCHAR_TO_UTF8_SUPPORT is…
Oct 31, 2022
bd5a81d
Check IsDebuggerPresent in msvc_sink before doing work. Fix #2408
gabime Oct 31, 2022
7aa0060
chrono.h: Remove warning suppression
gabime Nov 1, 2022
545c301
Update ci.yml
gabime Nov 1, 2022
6a9d561
Update ci.yml
gabime Nov 1, 2022
ad0e89c
Version 1.11.0
gabime Nov 2, 2022
63cef6a
Merge tag 'v1.11.0' into structured_v0_1_11_0
Pro Jun 5, 2023
a8caefa
fix context_data declaration 'class' -> 'struct'
DmitryYudin Jan 29, 2023
05d3236
fix: use class instead of struct for context_data
Pro Jun 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: ci

on: [push, pull_request]

jobs:
build_linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
matrix:
config:
- { compiler: gcc, version: 4.9, build_type: Release, cppstd: 11, examples: OFF, asan: OFF }
- { compiler: gcc, version: 7, build_type: Release, cppstd: 11 }
- { compiler: gcc, version: 9, build_type: Release, cppstd: 17 }
- { compiler: gcc, version: 11, build_type: Debug, cppstd: 20 }
- { compiler: gcc, version: 12, build_type: Release, cppstd: 20 }
- { compiler: clang, version: 3.5, build_type: Release, cppstd: 11, asan: OFF }
- { compiler: clang, version: 10, build_type: Release, cppstd: 11 }
- { compiler: clang, version: 10, build_type: Debug, cppstd: 17, asan: OFF }
- { compiler: clang, version: 12, build_type: Debug, cppstd: 17, asan: OFF }
- { compiler: clang, version: 15, build_type: Release, cppstd: 20, asan: OFF }
container:
image: ${{ matrix.config.compiler == 'clang' && 'teeks99/clang-ubuntu' || matrix.config.compiler }}:${{ matrix.config.version }}
name: "${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }})"
steps:
- uses: actions/checkout@main
- name: Setup
run: |
apt-get update && apt-get install -y curl
CMAKE_VERSION="3.24.2"
curl -sSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh -o install-cmake.sh
chmod +x install-cmake.sh
./install-cmake.sh --prefix=/usr/local --skip-license
- name: Setup Compiler
if: matrix.config.compiler == 'clang'
run: |
if [[ "${{ matrix.config.version }}" -ge 4 ]]; then
scripts/ci_setup_clang.sh "${{ matrix.config.version }}"
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
fi
echo "CC=clang-${{ matrix.config.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.config.version }}" >> $GITHUB_ENV
- name: Build
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.config.cppstd }} \
-DSPDLOG_BUILD_EXAMPLE=${{ matrix.config.examples || 'ON' }} \
-DSPDLOG_BUILD_EXAMPLE_HO=${{ matrix.config.examples || 'ON' }} \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_SANITIZE_ADDRESS=${{ matrix.config.asan || 'ON' }}
make -j2
ctest -j2 --output-on-failure

build_osx:
runs-on: macOS-latest
name: "OS X Clang (C++11, Release)"
steps:
- uses: actions/checkout@main
- name: Build
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=11 \
-DSPDLOG_BUILD_EXAMPLE=ON \
-DSPDLOG_BUILD_EXAMPLE_HO=ON \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_SANITIZE_ADDRESS=OFF
make -j2
ctest -j2 --output-on-failure

9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Auto generated files
[Dd]ebug/
[Rr]elease/
build/*
*.slo
*.lo
Expand Down Expand Up @@ -55,6 +57,7 @@ example/*

# generated files
generated
version.rc

# Cmake
CMakeCache.txt
Expand All @@ -67,6 +70,8 @@ install_manifest.txt
/tests/tests.VC.db
/tests/tests
/tests/logs/*
spdlogConfig.cmake
spdlogConfigVersion.cmake

# idea
.idea/
Expand All @@ -81,3 +86,7 @@ cmake-build-*/
*.tcl
*.user
*.sln

# macos
*.DS_store
*.xcodeproj/
155 changes: 0 additions & 155 deletions .travis.yml

This file was deleted.

32 changes: 29 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ option(SPDLOG_BUILD_SHARED "Build shared library" OFF)
# precompiled headers option
option(SPDLOG_ENABLE_PCH "Build static or shared library using precompiled header to speed up compilation time" OFF)

# build position independent code
option(SPDLOG_BUILD_PIC "Build position independent code (-fPIC)" OFF)

# example options
option(SPDLOG_BUILD_EXAMPLE "Build example" ${SPDLOG_MASTER_PROJECT})
option(SPDLOG_BUILD_EXAMPLE_HO "Build header only example" OFF)
Expand Down Expand Up @@ -134,15 +137,19 @@ if(SPDLOG_TIDY)
message(STATUS "Enabled clang-tidy")
endif()

if(SPDLOG_BUILD_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

find_package(Threads REQUIRED)
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
# ---------------------------------------------------------------------------------------
# Static/Shared library (shared not supported in windows yet)
# Static/Shared library
# ---------------------------------------------------------------------------------------
set(SPDLOG_SRCS src/spdlog.cpp src/stdout_sinks.cpp src/color_sinks.cpp src/file_sinks.cpp src/async.cpp src/cfg.cpp)

if(NOT SPDLOG_USE_STD_FORMAT AND NOT SPDLOG_FMT_EXTERNAL AND NOT SPDLOG_FMT_EXTERNAL_HO)
list(APPEND SPDLOG_SRCS src/fmt.cpp)
list(APPEND SPDLOG_SRCS src/bundled_fmtlib_format.cpp)
endif()

if(SPDLOG_BUILD_SHARED OR BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -171,7 +178,7 @@ target_include_directories(spdlog PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST
target_link_libraries(spdlog PUBLIC Threads::Threads)
spdlog_enable_warnings(spdlog)

set_target_properties(spdlog PROPERTIES VERSION ${SPDLOG_VERSION} SOVERSION ${SPDLOG_VERSION_MAJOR})
set_target_properties(spdlog PROPERTIES VERSION ${SPDLOG_VERSION} SOVERSION ${SPDLOG_VERSION_MAJOR}.${SPDLOG_VERSION_MINOR})
set_target_properties(spdlog PROPERTIES DEBUG_POSTFIX d)

if(COMMAND target_precompile_headers AND SPDLOG_ENABLE_PCH)
Expand Down Expand Up @@ -246,6 +253,11 @@ if(SPDLOG_NO_EXCEPTIONS AND NOT MSVC)
target_compile_options(spdlog PRIVATE -fno-exceptions)
endif()

if(SPDLOG_USE_STD_FORMAT)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

# ---------------------------------------------------------------------------------------
# Build binaries
# ---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -301,6 +313,16 @@ if(SPDLOG_INSTALL)
# ---------------------------------------------------------------------------------------
# Install pkg-config file
# ---------------------------------------------------------------------------------------
if (IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(PKG_CONFIG_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()
if (IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(PKG_CONFIG_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
else()
set(PKG_CONFIG_LIBDIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()
get_target_property(PKG_CONFIG_DEFINES spdlog INTERFACE_COMPILE_DEFINITIONS)
string(REPLACE ";" " -D" PKG_CONFIG_DEFINES "${PKG_CONFIG_DEFINES}")
string(CONCAT PKG_CONFIG_DEFINES "-D" "${PKG_CONFIG_DEFINES}")
Expand All @@ -310,6 +332,10 @@ if(SPDLOG_INSTALL)
# ---------------------------------------------------------------------------------------
# Install CMake config files
# ---------------------------------------------------------------------------------------
export(
TARGETS spdlog
NAMESPACE spdlog::
FILE "${CMAKE_CURRENT_BINARY_DIR}/${config_targets_file}")
install(EXPORT spdlog DESTINATION ${export_dest_dir} NAMESPACE spdlog:: FILE ${config_targets_file})

include(CMakePackageConfigHelpers)
Expand Down
Loading