cmake: honor WITH_FMT_HEADER_ONLY with vendored fmt lib

We're using the vendored fmt lib when there is no system library
available. However, there is an inconsistency: the
WITH_FMT_HEADER_ONLY setting is ignored by the vendored library.

In order to address this, we'll use the fmt-header-only alias
if WITH_FMT_HEADER_ONLY is set.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
This commit is contained in:
Lucian Petrut 2023-08-21 06:27:24 +00:00
parent d40edd3ac0
commit a09b70dfd8

View File

@ -335,6 +335,9 @@ else()
set(old_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS FALSE)
add_subdirectory(fmt)
if (WITH_FMT_HEADER_ONLY)
add_library(fmt::fmt ALIAS fmt-header-only)
endif()
set(BUILD_SHARED_LIBS ${old_BUILD_SHARED_LIBS})
unset(old_BUILD_SHARED_LIBS)
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/fmt/include")