File tree Expand file tree Collapse file tree 4 files changed +29
-7
lines changed Expand file tree Collapse file tree 4 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ set(AV_ENABLE_STATIC On CACHE BOOL "Enable static library build (On)")
1616set (AV_ENABLE_SHARED On CACHE BOOL "Enable shared library build (On)" )
1717set (AV_BUILD_EXAMPLES On CACHE BOOL "Build example applications (On)" )
1818
19- # Compiler-specific C++11 activation.
20- set (CMAKE_CXX_STANDARD 17)
19+ # Compiler-specific C++ standard activation
20+ # set(CMAKE_CXX_STANDARD 17)
2121set (CMAKE_CXX_STANDARD_REQUIRED yes )
2222
2323# Warnings
Original file line number Diff line number Diff line change @@ -38,6 +38,19 @@ foreach(TARGET ${AV_TARGETS})
3838 ${CMAKE_CURRENT_SOURCE_DIR} )
3939 set_target_properties (${TARGET} PROPERTIES PUBLIC_HEADER "${AV_HEADERS} " )
4040
41+ # If not CMAKE_CXX_STANARD provided globally (subproject), use latest supported one
42+ if (NOT CMAKE_CXX_STANDARD)
43+ if ("cxx_std_26" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
44+ target_compile_features (${TARGET} PUBLIC cxx_std_26)
45+ elseif ("cxx_std_23" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
46+ target_compile_features (${TARGET} PUBLIC cxx_std_23)
47+ elseif ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
48+ target_compile_features (${TARGET} PUBLIC cxx_std_20)
49+ else ()
50+ target_compile_features (${TARGET} PUBLIC cxx_std_17)
51+ endif ()
52+ endif ()
53+
4154 if (WIN32 )
4255 target_link_libraries (${TARGET} PRIVATE ws2_32)
4356 endif ()
Original file line number Diff line number Diff line change @@ -45,6 +45,14 @@ extern "C" {
4545# define FF_ENABLE_DEPRECATION_WARNINGS
4646#endif
4747
48+ #if __has_include(<compare>)
49+ # include < compare>
50+ # if defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907
51+ # define AVCPP_USE_SPACESHIP_OPERATOR 1
52+ # endif
53+ #endif
54+
55+
4856//
4957// Functions
5058//
Original file line number Diff line number Diff line change 55#include < memory>
66#include < type_traits>
77
8- #if __cplusplus > 201703L
9- #include < compare>
10- #endif
11-
128#include " ffmpeg.h"
9+ #include " avutils.h"
10+
11+ #ifdef AVCPP_USE_SPACESHIP_OPERATOR
12+ # include < compare>
13+ #endif
1314
1415namespace av
1516{
@@ -50,7 +51,7 @@ class Rational
5051 Rational& operator = (double value) noexcept ;
5152
5253 bool operator == (const Rational &other) const noexcept ;
53- #if __cplusplus > 201703L
54+ #ifdef AVCPP_USE_SPACESHIP_OPERATOR
5455 std::strong_ordering operator <=>(const Rational &other) const noexcept
5556 {
5657 switch (threewaycmp (other)) {
You can’t perform that action at this time.
0 commit comments