mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 03:07:36 +02:00
Use native c++ module support from CMake
also fix some clang compilation issues when using c++ modules
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.8...3.26)
|
cmake_minimum_required(VERSION 3.8...3.28)
|
||||||
|
|
||||||
# Fallback for using newer policies on CMake <3.12.
|
# Fallback for using newer policies on CMake <3.12.
|
||||||
if (${CMAKE_VERSION} VERSION_LESS 3.12)
|
if (${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||||
@ -62,6 +62,7 @@ function(add_module_library name)
|
|||||||
target_compile_options(${name} PUBLIC -fmodules-ts)
|
target_compile_options(${name} PUBLIC -fmodules-ts)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (CMAKE_VERSION VERSION_LESS 3.28)
|
||||||
# `std` is affected by CMake options and may be higher than C++20.
|
# `std` is affected by CMake options and may be higher than C++20.
|
||||||
get_target_property(std ${name} CXX_STANDARD)
|
get_target_property(std ${name} CXX_STANDARD)
|
||||||
|
|
||||||
@ -104,6 +105,9 @@ function(add_module_library name)
|
|||||||
endforeach ()
|
endforeach ()
|
||||||
endif ()
|
endif ()
|
||||||
target_sources(${name} PRIVATE ${sources})
|
target_sources(${name} PRIVATE ${sources})
|
||||||
|
else()
|
||||||
|
target_sources(${name} PUBLIC FILE_SET CXX_MODULES FILES ${sources})
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
include(CMakeParseArguments)
|
include(CMakeParseArguments)
|
||||||
|
@ -1069,6 +1069,8 @@ template <typename Locale> class format_facet : public Locale::facet {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FMT_END_EXPORT
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
// Returns true if value is negative, false otherwise.
|
// Returns true if value is negative, false otherwise.
|
||||||
@ -3865,6 +3867,7 @@ FMT_API void report_error(format_func func, int error_code,
|
|||||||
const char* message) noexcept;
|
const char* message) noexcept;
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
|
FMT_BEGIN_EXPORT
|
||||||
FMT_API auto vsystem_error(int error_code, string_view format_str,
|
FMT_API auto vsystem_error(int error_code, string_view format_str,
|
||||||
format_args args) -> std::system_error;
|
format_args args) -> std::system_error;
|
||||||
|
|
||||||
@ -4285,6 +4288,8 @@ extern template FMT_API auto decimal_point_impl(locale_ref) -> char;
|
|||||||
extern template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t;
|
extern template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t;
|
||||||
#endif // FMT_HEADER_ONLY
|
#endif // FMT_HEADER_ONLY
|
||||||
|
|
||||||
|
FMT_END_EXPORT
|
||||||
|
|
||||||
template <typename T, typename Char, type TYPE>
|
template <typename T, typename Char, type TYPE>
|
||||||
template <typename FormatContext>
|
template <typename FormatContext>
|
||||||
FMT_CONSTEXPR FMT_INLINE auto native_formatter<T, Char, TYPE>::format(
|
FMT_CONSTEXPR FMT_INLINE auto native_formatter<T, Char, TYPE>::format(
|
||||||
@ -4300,7 +4305,6 @@ FMT_CONSTEXPR FMT_INLINE auto native_formatter<T, Char, TYPE>::format(
|
|||||||
return write<Char>(ctx.out(), val, specs, ctx.locale());
|
return write<Char>(ctx.out(), val, specs, ctx.locale());
|
||||||
}
|
}
|
||||||
|
|
||||||
FMT_END_EXPORT
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
FMT_BEGIN_EXPORT
|
FMT_BEGIN_EXPORT
|
||||||
|
Reference in New Issue
Block a user