mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-05 13:14:29 +02:00
build: UNITS_USE_LIBFMT
support improved
This commit is contained in:
@@ -151,16 +151,6 @@ Additionally, enables project documentation generation when the project is being
|
||||
CMake Options
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
UNITS_DOWNCAST_MODE
|
||||
+++++++++++++++++++
|
||||
|
||||
**Values**: ``OFF``/``ON``/``AUTO``
|
||||
|
||||
**Defaulted to**: ``ON``
|
||||
|
||||
Equivalent to `downcast_mode`_.
|
||||
|
||||
|
||||
UNITS_AS_SYSTEM_HEADERS
|
||||
+++++++++++++++++++++++
|
||||
|
||||
@@ -171,6 +161,26 @@ UNITS_AS_SYSTEM_HEADERS
|
||||
Exports library as system headers.
|
||||
|
||||
|
||||
UNITS_BUILD_DOCS
|
||||
++++++++++++++++
|
||||
|
||||
**Values**: ``ON``/``OFF``
|
||||
|
||||
**Defaulted to**: ``ON``
|
||||
|
||||
Enables project documentation generation.
|
||||
|
||||
|
||||
UNITS_DOWNCAST_MODE
|
||||
+++++++++++++++++++
|
||||
|
||||
**Values**: ``OFF``/``ON``/``AUTO``
|
||||
|
||||
**Defaulted to**: ``ON``
|
||||
|
||||
Equivalent to `downcast_mode`_.
|
||||
|
||||
|
||||
UNITS_IWYU
|
||||
++++++++++
|
||||
|
||||
@@ -182,14 +192,14 @@ Enables include-what-you-use when compiling with a clang compiler.
|
||||
Additionally turns on `UNITS_AS_SYSTEM_HEADERS`_.
|
||||
|
||||
|
||||
UNITS_BUILD_DOCS
|
||||
UNITS_USE_LIBFMT
|
||||
++++++++++++++++
|
||||
|
||||
**Values**: ``ON``/``OFF``
|
||||
|
||||
**Defaulted to**: ``ON``
|
||||
|
||||
Enables project documentation generation.
|
||||
Enables usage of `{fmt} <https://github.com/fmtlib/fmt>`_ library instead of the C++20 Standard Library feature.
|
||||
|
||||
|
||||
Installation and Reuse
|
||||
|
@@ -22,14 +22,13 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
option(UNITS_USE_LIBFMT "Enables usage of libfmt instead of the one from 'std'" OFF)
|
||||
option(UNITS_USE_LIBFMT "Enables usage of libfmt instead of the one from 'std'" ON)
|
||||
message(STATUS "UNITS_USE_LIBFMT: ${UNITS_USE_LIBFMT}")
|
||||
|
||||
# find dependencies
|
||||
find_package(fmt CONFIG REQUIRED)
|
||||
|
||||
add_units_module(core-fmt mp-units::core)
|
||||
target_compile_definitions(mp-units-core-fmt INTERFACE UNITS_USE_LIBFMT=$<BOOL:${UNITS_USE_LIBFMT}>)
|
||||
|
||||
if(UNITS_USE_LIBFMT)
|
||||
find_package(fmt CONFIG REQUIRED)
|
||||
target_link_libraries(mp-units-core-fmt INTERFACE fmt::fmt)
|
||||
target_compile_definitions(mp-units-core-fmt INTERFACE UNITS_USE_LIBFMT)
|
||||
endif()
|
||||
|
@@ -29,6 +29,10 @@
|
||||
|
||||
#include <units/bits/external/hacks.h>
|
||||
|
||||
#ifndef UNITS_USE_LIBFMT
|
||||
#define UNITS_USE_LIBFMT 1
|
||||
#endif
|
||||
|
||||
#if UNITS_USE_LIBFMT
|
||||
|
||||
UNITS_DIAGNOSTIC_PUSH
|
||||
|
Reference in New Issue
Block a user