cmake: treat linker warnings as errors when configuring with SDL_WERROR=ON

This commit is contained in:
Anonymous Maarten
2026-01-30 18:41:16 +01:00
committed by Anonymous Maarten
parent 997a168e00
commit e338287e64

View File

@@ -155,6 +155,18 @@ function(SDL_AddCommonCompilerFlags TARGET)
endif()
endif()
endif()
if(NOT (APPLE OR MSVC))
if(SDL_WERROR)
get_property(target_type TARGET ${TARGET} PROPERTY TYPE)
if(target_type MATCHES "SHARED_LIBRARY|MODULE_LIBRARY")
check_linker_flag(C "-Wl,-fatal-warnings" LINKER_SUPPORTS_WL_FATAL_WARNINGS)
if(LINKER_SUPPORTS_WL_FATAL_WARNINGS)
target_link_options(${TARGET} PRIVATE "-Wl,-fatal-warnings")
endif()
endif()
endif()
endif()
endif()
if(USE_CLANG)