build: only add compiler flag if it is supported

This ensures that we only add the flag if it is supported by the
compiler rather than doing it unconditionally.
This commit is contained in:
Saleem Abdulrasool
2025-01-21 09:34:44 -08:00
parent cc9713be6d
commit c9e4dff925

View File

@@ -295,7 +295,9 @@ macro(swift_common_cxx_warnings)
if(MSVC)
check_cxx_compiler_flag("/we4062" CXX_SUPPORTS_WE4062)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/we4062>)
if(CXX_SUPPORTS_WE4062)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/we4062>)
endif()
endif()
endif()