From 52368631aa095b2b5e5667396922b31f4fc06b9f Mon Sep 17 00:00:00 2001 From: Wan-Teh Chang Date: Fri, 19 Jul 2024 12:20:30 -0700 Subject: [PATCH] Use /std:clatest with MSVC, remove -Wunused-result Use -std=gnu2x with Clang and GCC only. Use Use /std:clatest with MSVC. Remove -Wunused-result. Clang and GCC enable it by default, and MSVC doesn't support it. --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 381237d089..21aee88c98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,9 +324,12 @@ if(AVIF_ENABLE_NODISCARD) else() unset(CMAKE_C_STANDARD) set_property(TARGET avif_obj PROPERTY C_STANDARD) - target_compile_options(avif_obj PUBLIC $:-std=gnu2x>>) + if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "GNU") + target_compile_options(avif_obj PUBLIC $:-std=gnu2x>>) + elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") + target_compile_options(avif_obj PUBLIC $:/std:clatest>>) + endif() endif() - target_compile_options(avif_obj PUBLIC $) target_compile_definitions(avif_obj PUBLIC $) endif()