[loguru] Add feature to build with fmt (#23242)

* [loguru] Add loguru[fmt] feature

Add fmt feature, with if checks to require and link fmt if it is specified

* [loguru] Replace deprecated functions

Remove deprecated functions vcpkg_install_cmake, vcpkg_fixup_cmake_targets, vcpkg_configure_cmake and replace them with vcpkg_cmake_install, vcpkg_cmake_config_fixup and vcpkg_cmake_configure respectively.
Also add vcpkg-cmake and vcpkg-cmake-config to vcpkg.json to provide the replacements

* [loguru] Update versioning files

* [loguru] Add CONFIG flag to find_package(fmt)

* Make suggested changes

* Update version database

* Make requested changes

* [loguru] Update version database
This commit is contained in:
mrlegohead0x45 2022-04-08 23:23:48 +01:00 коммит произвёл GitHub
Родитель 6f706ab611
Коммит 91dd9ae821
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 46 добавлений и 9 удалений

Просмотреть файл

@ -4,6 +4,7 @@ project(loguru CXX)
set(CMAKE_CXX_STANDARD 11)
option(INSTALL_HEADERS "Install header files" ON)
option(BUILD_WITH_FMT "Build with fmt support" OFF)
set(loguru_headers
loguru.hpp
@ -17,6 +18,12 @@ target_include_directories(loguru PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/loguru>)
if(BUILD_WITH_FMT)
target_compile_definitions(loguru PRIVATE LOGURU_USE_FMTLIB=1)
find_package(fmt CONFIG REQUIRED)
target_link_libraries(loguru PUBLIC fmt::fmt)
endif()
if(UNIX)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

Просмотреть файл

@ -15,15 +15,22 @@ if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)
configure_file(${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt ${SOURCE_PATH}/CMakeLists.txt COPYONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/loguruConfig.cmake.in ${SOURCE_PATH}/loguruConfig.cmake.in COPYONLY)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
fmt BUILD_WITH_FMT
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG
-DINSTALL_HEADERS=OFF
OPTIONS
${FEATURE_OPTIONS}
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets()
vcpkg_cmake_install()
vcpkg_cmake_config_fixup()
vcpkg_copy_pdbs()
endif()

Просмотреть файл

@ -1,7 +1,25 @@
{
"name": "loguru",
"version-string": "2.1.0",
"port-version": 2,
"version": "2.1.0",
"port-version": 3,
"description": "A lightweight and flexible C++ logging library",
"homepage": "https://github.com/emilk/loguru"
"homepage": "https://github.com/emilk/loguru",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"fmt": {
"description": "Build with fmt support in non-header-only mode",
"dependencies": [
"fmt"
]
}
}
}

Просмотреть файл

@ -4270,7 +4270,7 @@
},
"loguru": {
"baseline": "2.1.0",
"port-version": 2
"port-version": 3
},
"lpeg": {
"baseline": "1.0.2",

Просмотреть файл

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "827f85e170a1d4548088fa36cf46817e146184d0",
"version": "2.1.0",
"port-version": 3
},
{
"git-tree": "c429f674d828c20881f410892d633b483e9d30dd",
"version-string": "2.1.0",