Skip to content

(cmake): add option to build with warnings as errors

What does this MR do?

  • Added a cmake option WARNINGS_AS_ERRORS in sight to build a project in warning as error (/Wx on MSVC or -Werror on gcc/clang)
  • Removed warning in sight project fwlauncher
  • Added this new option WARNINGS_AS_ERRORS in fwlauncher project
  • Change warning level to w4 on Windows (to see unreferenced local variable)

How to test it?

on Windows, thios MR requires a recent version of MSVC 2017 (> Visual Studio 15.6)

  • build fwlauncher, there is no more warning, so it's compiled
  • add a crappy code that produces a warning(*), the compilation of fwlauncher will fail

(*) simple sample of code that produces a warning:

int warning = 0.;

Data

no required data

Some results

on windows, a project with warnings will produce this error:

error C2220: warning treated as error - no 'object' file generated

on macOS or linux, a project with warnings will produce this type of error:

error: unused variable 'bundlePath' [-Werror,-Wunused-variable]

There are very few projects in Sight that don't have warning, there's a lot of work to improve the code. This MR is the first step 😉

Additional tests to run

  • Build on Windows
  • Build on Linux
  • Build on macOS

Associated Issue

Closes #313 (closed)

Edited by Emilie WERNERT

Merge request reports