SFML / cmake-sfml-project

Repository template for SFML projects using CMake
Other
315 stars 197 forks source link

Consider disabling warnings as errors within SFML #15

Closed ChrisThrasher closed 1 year ago

ChrisThrasher commented 1 year ago

https://github.com/SFML/SFML/pull/2464

STB Image 2.28 included some new code that triggers an MSVC warning related to lossy conversions. When using CMake 3.24 or newer, CMake has the ability to tell MSVC to ignore warnings in 3rd party code. However anyone using an older version does not get that fix and thus MSVC emits a warning about this 3rd party code which due to the default of WARNINGS_AS_ERRORS get promoted to a error that breaks the build.

This was never caught in SFML's CI pipeline because GitHub Actions CI runners always use the latest CMake release which means they've been using CMake 3.24 or newer for many months now. Users on VS 2019 have an older release of CMake and thus are prone to encounter this problem.

All we need is set(WARNINGS_AS_ERRORS OFF) before the FetchContent call unless we're willing to fix this upstream in SFML itself.

ChrisThrasher commented 1 year ago

See SFML/SFML#2678

ChrisThrasher commented 1 year ago

SFML upstream now disables warnings as errors in both v2 and v3. This should take a lot of pressure of us to deal with the warnings that are harder to fix like this stb_image warning. Now users won't have to deal with them when using the template.