Skip to content

Commit

Permalink
Use /std:clatest with MSVC, remove -Wunused-result
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wantehchang authored Jul 19, 2024
1 parent 1d4b04d commit 5236863
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:C>:-std=gnu2x>>)
if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "GNU")
target_compile_options(avif_obj PUBLIC $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:C>:-std=gnu2x>>)
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
target_compile_options(avif_obj PUBLIC $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:C>:/std:clatest>>)
endif()
endif()
target_compile_options(avif_obj PUBLIC $<BUILD_INTERFACE:-Wunused-result>)
target_compile_definitions(avif_obj PUBLIC $<BUILD_INTERFACE:AVIF_ENABLE_NODISCARD=1>)
endif()

Expand Down

0 comments on commit 5236863

Please sign in to comment.