mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-21 10:20:03 +00:00
Fix std::variant, std::filesystem::path tests on GCC-8, Clang-7,8.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
This commit is contained in:
parent
e29c2bc60e
commit
99bb5b1d17
@ -17,10 +17,17 @@
|
||||
#if FMT_HAS_INCLUDE(<version>)
|
||||
# include <version>
|
||||
#endif
|
||||
// Checking FMT_CPLUSPLUS for warning suppression in MSVC.
|
||||
#if FMT_CPLUSPLUS >= 201703L
|
||||
# if FMT_HAS_INCLUDE(<filesystem>)
|
||||
# include <filesystem>
|
||||
# endif
|
||||
# if FMT_HAS_INCLUDE(<variant>)
|
||||
# include <variant>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_lib_filesystem
|
||||
# include <filesystem>
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
namespace detail {
|
||||
@ -71,8 +78,6 @@ struct formatter<std::thread::id, Char> : basic_ostream_formatter<Char> {};
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#ifdef __cpp_lib_variant
|
||||
# include <variant>
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
template <typename Char> struct formatter<std::monostate, Char> {
|
||||
template <typename ParseContext>
|
||||
|
@ -78,6 +78,14 @@ add_fmt_test(printf-test)
|
||||
add_fmt_test(ranges-test ranges-odr-test.cc)
|
||||
add_fmt_test(scan-test)
|
||||
add_fmt_test(std-test)
|
||||
try_compile(compile_result_unused
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
SOURCES ${CMAKE_CURRENT_LIST_DIR}/detect-stdfs.cc
|
||||
OUTPUT_VARIABLE RAWOUTPUT)
|
||||
string(REGEX REPLACE ".*libfound \"([^\"]*)\".*" "\\1" STDLIBFS "${RAWOUTPUT}")
|
||||
if (STDLIBFS)
|
||||
target_link_libraries(std-test ${STDLIBFS})
|
||||
endif ()
|
||||
add_fmt_test(unicode-test HEADER_ONLY)
|
||||
if (MSVC)
|
||||
target_compile_options(unicode-test PRIVATE /utf-8)
|
||||
|
18
test/detect-stdfs.cc
Normal file
18
test/detect-stdfs.cc
Normal file
@ -0,0 +1,18 @@
|
||||
// Formatting library for C++ - tests of formatters for standard library types
|
||||
//
|
||||
// Copyright (c) 2012 - present, Victor Zverovich
|
||||
// All rights reserved.
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#include <exception> // _GLIBCXX_RELEASE & _LIBCPP_VERSION
|
||||
|
||||
#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE == 8
|
||||
# error libfound "stdc++fs"
|
||||
#elif !defined(__apple_build_version__) && defined(_LIBCPP_VERSION) && \
|
||||
_LIBCPP_VERSION >= 7000 && _LIBCPP_VERSION < 9000
|
||||
# error libfound "c++fs"
|
||||
#else
|
||||
// none if std::filesystem does not require additional libraries
|
||||
# error libfound ""
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user