mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 10:57:16 +02:00
refactor: 💥 MP_UNITS_USE_LIBFMT
renamed to MP_UNITS_USE_FMTLIB
This commit is contained in:
@ -146,7 +146,7 @@ class MPUnitsConan(ConanFile):
|
||||
tc.variables["CMAKE_CXX_SCAN_FOR_MODULES"] = True
|
||||
tc.variables["MP_UNITS_BUILD_CXX_MODULES"] = True
|
||||
tc.variables["MP_UNITS_BUILD_LA"] = self._build_all and not self._skip_la
|
||||
tc.variables["MP_UNITS_USE_LIBFMT"] = self._use_libfmt
|
||||
tc.variables["MP_UNITS_USE_FMTLIB"] = self._use_libfmt
|
||||
tc.generate()
|
||||
deps = CMakeDeps(self)
|
||||
deps.generate()
|
||||
|
@ -221,6 +221,16 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"}
|
||||
[build_cxx_modules support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0
|
||||
|
||||
|
||||
[`MP_UNITS_USE_FMTLIB`](#MP_UNITS_USE_FMTLIB){ #MP_UNITS_USE_FMTLIB }
|
||||
|
||||
: [:octicons-tag-24: 2.2.0][use fmtlib support] · :octicons-milestone-24: `ON`/`OFF` (Default: `ON`)
|
||||
|
||||
Forces usage of [{fmt}](https://github.com/fmtlib/fmt) library instead of the C++20 Standard
|
||||
Library features.
|
||||
|
||||
[use fmtlib support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0
|
||||
|
||||
|
||||
[`MP_UNITS_AS_SYSTEM_HEADERS`](#MP_UNITS_AS_SYSTEM_HEADERS){ #MP_UNITS_AS_SYSTEM_HEADERS }
|
||||
|
||||
: [:octicons-tag-24: 2.0.0][as system headers support] · :octicons-milestone-24: `ON`/`OFF` (Default: `OFF`)
|
||||
@ -249,16 +259,6 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"}
|
||||
[iwyu support]: https://github.com/mpusz/mp-units/releases/tag/v2.0.0
|
||||
|
||||
|
||||
[`MP_UNITS_USE_LIBFMT`](#MP_UNITS_USE_LIBFMT){ #MP_UNITS_USE_LIBFMT }
|
||||
|
||||
: [:octicons-tag-24: 2.0.0][use libfmt support] · :octicons-milestone-24: `ON`/`OFF` (Default: `ON`)
|
||||
|
||||
Forces usage of [{fmt}](https://github.com/fmtlib/fmt) library instead of the C++20 Standard
|
||||
Library features.
|
||||
|
||||
[use libfmt support]: https://github.com/mpusz/mp-units/releases/tag/v2.0.0
|
||||
|
||||
|
||||
## CMake with presets support
|
||||
|
||||
It is recommended to use at least CMake 3.23 to build this project as this version introduced support
|
||||
|
@ -155,5 +155,5 @@ use [fmtlib](https://github.com/fmtlib/fmt) as their primary formatting facility
|
||||
from additional features provided with the library).
|
||||
|
||||
This macro resolves to either the `std` or `fmt` namespace, depending on the value of
|
||||
[MP_UNITS_USE_LIBFMT](../../getting_started/installation_and_usage.md#MP_UNITS_USE_LIBFMT)
|
||||
[MP_UNITS_USE_FMTLIB](../../getting_started/installation_and_usage.md#MP_UNITS_USE_FMTLIB)
|
||||
CMake option.
|
||||
|
@ -31,8 +31,8 @@ message(STATUS "${projectPrefix}BUILD_CXX_MODULES: ${${projectPrefix}BUILD_CXX_M
|
||||
option(${projectPrefix}AS_SYSTEM_HEADERS "Exports library as system headers" OFF)
|
||||
message(STATUS "${projectPrefix}AS_SYSTEM_HEADERS: ${${projectPrefix}AS_SYSTEM_HEADERS}")
|
||||
|
||||
option(${projectPrefix}USE_LIBFMT "Enables usage of libfmt instead of the one from 'std'" ON)
|
||||
message(STATUS "${projectPrefix}USE_LIBFMT: ${${projectPrefix}USE_LIBFMT}")
|
||||
option(${projectPrefix}USE_FMTLIB "Enables usage of fmtlib instead of the 'std::format' facilities" ON)
|
||||
message(STATUS "${projectPrefix}USE_FMTLIB: ${${projectPrefix}USE_FMTLIB}")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
|
@ -78,10 +78,10 @@ add_mp_units_module(
|
||||
)
|
||||
|
||||
target_compile_definitions(
|
||||
mp-units-core ${${projectPrefix}TARGET_SCOPE} ${projectPrefix}USE_LIBFMT=$<BOOL:${${projectPrefix}USE_LIBFMT}>
|
||||
mp-units-core ${${projectPrefix}TARGET_SCOPE} ${projectPrefix}USE_FMTLIB=$<BOOL:${${projectPrefix}USE_FMTLIB}>
|
||||
)
|
||||
|
||||
if(${projectPrefix}USE_LIBFMT)
|
||||
if(${projectPrefix}USE_FMTLIB)
|
||||
if(NOT TARGET fmt::fmt)
|
||||
find_package(fmt REQUIRED)
|
||||
endif()
|
||||
|
@ -100,11 +100,11 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef MP_UNITS_USE_LIBFMT
|
||||
#define MP_UNITS_USE_LIBFMT 1
|
||||
#ifndef MP_UNITS_USE_FMTLIB
|
||||
#define MP_UNITS_USE_FMTLIB 1
|
||||
#endif
|
||||
|
||||
#if MP_UNITS_USE_LIBFMT
|
||||
#if MP_UNITS_USE_FMTLIB
|
||||
|
||||
MP_UNITS_DIAGNOSTIC_PUSH
|
||||
MP_UNITS_DIAGNOSTIC_IGNORE_UNREACHABLE
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
if(MP_UNITS_USE_LIBFMT)
|
||||
if(MP_UNITS_USE_FMTLIB)
|
||||
find_dependency(fmt)
|
||||
endif()
|
||||
|
||||
|
@ -27,4 +27,4 @@ find_package(mp-units REQUIRED)
|
||||
|
||||
add_executable(test_package test_package.cpp)
|
||||
target_link_libraries(test_package PRIVATE mp-units::mp-units)
|
||||
target_compile_definitions(test_package PRIVATE MP_UNITS_USE_LIBFMT=$<BOOL:${MP_UNITS_USE_LIBFMT}>)
|
||||
target_compile_definitions(test_package PRIVATE MP_UNITS_USE_FMTLIB=$<BOOL:${MP_UNITS_USE_FMTLIB}>)
|
||||
|
@ -47,7 +47,7 @@ class TestPackageConan(ConanFile):
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["MP_UNITS_USE_LIBFMT"] = self._use_libfmt
|
||||
tc.variables["MP_UNITS_USE_FMTLIB"] = self._use_libfmt
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
|
Reference in New Issue
Block a user