refactor: 💥 MP_UNITS_USE_LIBFMT renamed to MP_UNITS_USE_FMTLIB

This commit is contained in:
Mateusz Pusz
2024-01-12 14:18:57 +01:00
parent b7bb1c605d
commit cc9947bd8b
9 changed files with 22 additions and 22 deletions

View File

@ -146,7 +146,7 @@ class MPUnitsConan(ConanFile):
tc.variables["CMAKE_CXX_SCAN_FOR_MODULES"] = True tc.variables["CMAKE_CXX_SCAN_FOR_MODULES"] = True
tc.variables["MP_UNITS_BUILD_CXX_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_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() tc.generate()
deps = CMakeDeps(self) deps = CMakeDeps(self)
deps.generate() deps.generate()

View File

@ -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 [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 } [`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`) : [: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 [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 ## CMake with presets support
It is recommended to use at least CMake 3.23 to build this project as this version introduced support It is recommended to use at least CMake 3.23 to build this project as this version introduced support

View File

@ -155,5 +155,5 @@ use [fmtlib](https://github.com/fmtlib/fmt) as their primary formatting facility
from additional features provided with the library). from additional features provided with the library).
This macro resolves to either the `std` or `fmt` namespace, depending on the value of 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. CMake option.

View File

@ -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) option(${projectPrefix}AS_SYSTEM_HEADERS "Exports library as system headers" OFF)
message(STATUS "${projectPrefix}AS_SYSTEM_HEADERS: ${${projectPrefix}AS_SYSTEM_HEADERS}") 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) option(${projectPrefix}USE_FMTLIB "Enables usage of fmtlib instead of the 'std::format' facilities" ON)
message(STATUS "${projectPrefix}USE_LIBFMT: ${${projectPrefix}USE_LIBFMT}") message(STATUS "${projectPrefix}USE_FMTLIB: ${${projectPrefix}USE_FMTLIB}")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

View File

@ -78,10 +78,10 @@ add_mp_units_module(
) )
target_compile_definitions( 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) if(NOT TARGET fmt::fmt)
find_package(fmt REQUIRED) find_package(fmt REQUIRED)
endif() endif()

View File

@ -100,11 +100,11 @@
#endif #endif
#ifndef MP_UNITS_USE_LIBFMT #ifndef MP_UNITS_USE_FMTLIB
#define MP_UNITS_USE_LIBFMT 1 #define MP_UNITS_USE_FMTLIB 1
#endif #endif
#if MP_UNITS_USE_LIBFMT #if MP_UNITS_USE_FMTLIB
MP_UNITS_DIAGNOSTIC_PUSH MP_UNITS_DIAGNOSTIC_PUSH
MP_UNITS_DIAGNOSTIC_IGNORE_UNREACHABLE MP_UNITS_DIAGNOSTIC_IGNORE_UNREACHABLE

View File

@ -22,7 +22,7 @@
include(CMakeFindDependencyMacro) include(CMakeFindDependencyMacro)
if(MP_UNITS_USE_LIBFMT) if(MP_UNITS_USE_FMTLIB)
find_dependency(fmt) find_dependency(fmt)
endif() endif()

View File

@ -27,4 +27,4 @@ find_package(mp-units REQUIRED)
add_executable(test_package test_package.cpp) add_executable(test_package test_package.cpp)
target_link_libraries(test_package PRIVATE mp-units::mp-units) 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}>)

View File

@ -47,7 +47,7 @@ class TestPackageConan(ConanFile):
def generate(self): def generate(self):
tc = CMakeToolchain(self) tc = CMakeToolchain(self)
tc.variables["MP_UNITS_USE_LIBFMT"] = self._use_libfmt tc.variables["MP_UNITS_USE_FMTLIB"] = self._use_libfmt
tc.generate() tc.generate()
def build(self): def build(self):