mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-30 20:59:12 +08:00
f643622019
Using an external fmt lib should cause the spdlog::spdlog target to have a dependency on fmt lib - so that a consuming project does not need to call find_package(fmt) and target_link_libraries(... fmt::fmt). To this end a new cmake option SPDLOG_FMT_EXTERNAL is introduced which makes spdlog depend on fmt lib and defines the SPDLOG_FMT_EXTERNAL macro to avoid using the bundled fmt lib. The value of SPDLOG_FMT_EXTERNAL is also stored in the installed spdlogConfig.cmake and if it is ON find_dependency() is used to ensure the fmt::fmt target is imported.
34 lines
1.0 KiB
CMake
34 lines
1.0 KiB
CMake
#header-only library
|
|
include(vcpkg_common_functions)
|
|
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO gabime/spdlog
|
|
REF v1.2.1
|
|
SHA512 418f91efc207fa227558212d82c41639c0bb59e84ea47447e0b6276c4842e97f1f8aaf5802c071ef15d80ec525e317e70b6a39661a6c96ab39d33d9bd1570da1
|
|
HEAD_REF v1.x
|
|
PATCHES
|
|
fmt-external-cmake-option.patch
|
|
)
|
|
|
|
vcpkg_configure_cmake(
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
PREFER_NINJA
|
|
OPTIONS
|
|
-DSPDLOG_BUILD_TESTING=OFF
|
|
-DSPDLOG_FMT_EXTERNAL=ON
|
|
)
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/spdlog)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib)
|
|
|
|
# use vcpkg-provided fmt library (see also option SPDLOG_FMT_EXTERNAL above)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/spdlog/fmt/bundled)
|
|
|
|
# Handle copyright
|
|
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/spdlog)
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/spdlog/LICENSE ${CURRENT_PACKAGES_DIR}/share/spdlog/copyright)
|