Add a flag to disable the inclusion of <format> and the provision for std::formatter specializations
This commit is contained in:
parent
dbeb12b71d
commit
aae6091395
@ -306,6 +306,10 @@ target_compile_features(
|
|||||||
|
|
||||||
target_compile_definitions(${target_name} PRIVATE NOMINMAX)
|
target_compile_definitions(${target_name} PRIVATE NOMINMAX)
|
||||||
|
|
||||||
|
if(NOT CPPTRACE_STD_FORMAT)
|
||||||
|
target_compile_definitions(${target_name} PUBLIC CPPTRACE_NO_STD_FORMAT)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||||
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||||
|
|||||||
@ -952,6 +952,8 @@ Other useful configurations:
|
|||||||
- `CPPTRACE_INSTALL_CMAKEDIR`: Override for the installation path for the cmake configs.
|
- `CPPTRACE_INSTALL_CMAKEDIR`: Override for the installation path for the cmake configs.
|
||||||
- `CPPTRACE_USE_EXTERNAL_LIBDWARF=On/Off`: Get libdwarf from `find_package` rather than `FetchContent`.
|
- `CPPTRACE_USE_EXTERNAL_LIBDWARF=On/Off`: Get libdwarf from `find_package` rather than `FetchContent`.
|
||||||
- `CPPTRACE_POSITION_INDEPENDENT_CODE=On/Off`: Compile the library as a position independent code (PIE). Defaults to On.
|
- `CPPTRACE_POSITION_INDEPENDENT_CODE=On/Off`: Compile the library as a position independent code (PIE). Defaults to On.
|
||||||
|
- `CPPTRACE_STD_FORMAT=On/Off`: Control inclusion of `<format>` and provision of `std::formatter` specializations by
|
||||||
|
cpptrace.hpp. This can also be controlled with the macro `CPPTRACE_NO_STD_FORMAT`.
|
||||||
|
|
||||||
Testing:
|
Testing:
|
||||||
- `CPPTRACE_BUILD_TESTING` Build small demo and test program
|
- `CPPTRACE_BUILD_TESTING` Build small demo and test program
|
||||||
|
|||||||
@ -171,6 +171,7 @@ option(CPPTRACE_SANITIZER_BUILD "" OFF)
|
|||||||
option(CPPTRACE_WERROR_BUILD "" OFF)
|
option(CPPTRACE_WERROR_BUILD "" OFF)
|
||||||
option(CPPTRACE_POSITION_INDEPENDENT_CODE "" ON)
|
option(CPPTRACE_POSITION_INDEPENDENT_CODE "" ON)
|
||||||
option(CPPTRACE_SKIP_UNIT "" OFF)
|
option(CPPTRACE_SKIP_UNIT "" OFF)
|
||||||
|
option(CPPTRACE_STD_FORMAT "" ON)
|
||||||
option(CPPTRACE_USE_EXTERNAL_GTEST "" OFF)
|
option(CPPTRACE_USE_EXTERNAL_GTEST "" OFF)
|
||||||
set(CPPTRACE_ZSTD_REPO "https://github.com/facebook/zstd.git" CACHE STRING "")
|
set(CPPTRACE_ZSTD_REPO "https://github.com/facebook/zstd.git" CACHE STRING "")
|
||||||
set(CPPTRACE_ZSTD_TAG "63779c798237346c2b245c546c40b72a5a5913fe" CACHE STRING "") # v1.5.5
|
set(CPPTRACE_ZSTD_TAG "63779c798237346c2b245c546c40b72a5a5913fe" CACHE STRING "") # v1.5.5
|
||||||
|
|||||||
@ -34,11 +34,13 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __cplusplus >= 202002L
|
#ifndef CPPTRACE_NO_STD_FORMAT
|
||||||
#ifdef __has_include
|
#if __cplusplus >= 202002L
|
||||||
#if __has_include(<format>)
|
#ifdef __has_include
|
||||||
#define CPPTRACE_STD_FORMAT
|
#if __has_include(<format>)
|
||||||
#include <format>
|
#define CPPTRACE_STD_FORMAT
|
||||||
|
#include <format>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user