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)")
16
16
set (AV_ENABLE_SHARED On CACHE BOOL "Enable shared library build (On)" )
17
17
set (AV_BUILD_EXAMPLES On CACHE BOOL "Build example applications (On)" )
18
18
19
- # Compiler-specific C++11 activation.
20
- set (CMAKE_CXX_STANDARD 17 )
19
+ # Compiler-specific C++ standard activation
20
+ # set(CMAKE_CXX_STANDARD 17)
21
21
set (CMAKE_CXX_STANDARD_REQUIRED yes )
22
22
23
23
# Warnings
Original file line number Diff line number Diff line change @@ -38,6 +38,19 @@ foreach(TARGET ${AV_TARGETS})
38
38
${CMAKE_CURRENT_SOURCE_DIR} )
39
39
set_target_properties (${TARGET} PROPERTIES PUBLIC_HEADER "${AV_HEADERS} " )
40
40
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
+
41
54
if (WIN32 )
42
55
target_link_libraries (${TARGET} PRIVATE ws2_32 )
43
56
endif ()
Original file line number Diff line number Diff line change @@ -45,6 +45,14 @@ extern "C" {
45
45
# define FF_ENABLE_DEPRECATION_WARNINGS
46
46
#endif
47
47
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
+
48
56
//
49
57
// Functions
50
58
//
Original file line number Diff line number Diff line change 5
5
#include < memory>
6
6
#include < type_traits>
7
7
8
- #if __cplusplus > 201703L
9
- #include < compare>
10
- #endif
11
-
12
8
#include " ffmpeg.h"
9
+ #include " avutils.h"
10
+
11
+ #ifdef AVCPP_USE_SPACESHIP_OPERATOR
12
+ # include < compare>
13
+ #endif
13
14
14
15
namespace av
15
16
{
@@ -50,7 +51,7 @@ class Rational
50
51
Rational& operator = (double value) noexcept ;
51
52
52
53
bool operator == (const Rational &other) const noexcept ;
53
- #if __cplusplus > 201703L
54
+ #ifdef AVCPP_USE_SPACESHIP_OPERATOR
54
55
std::strong_ordering operator <=>(const Rational &other) const noexcept
55
56
{
56
57
switch (threewaycmp (other)) {
You can’t perform that action at this time.
0 commit comments