From 920f70f428529efc1fb1f098af32f83fb3f6e1d1 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Thu, 18 Jul 2024 17:10:57 +0200 Subject: [PATCH] Set C++ version to 17 when using [[no_discard]] (#2291) 17 was introduced in CMake 3.8 https://cmake.org/cmake/help/v3.8/prop_tgt/CXX_STANDARD.html --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6770a86119..2beb9d996b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -645,7 +645,11 @@ endif() if(AVIF_USE_CXX) enable_language(CXX) - set(CMAKE_CXX_STANDARD 14) + if(AVIF_ENABLE_NODISCARD) + set(CMAKE_CXX_STANDARD 17) + else() + set(CMAKE_CXX_STANDARD 14) + endif() endif() option(AVIF_BUILD_APPS "Build avif apps." OFF)