Enable compiler warnings

Can someone tell me the magic CMake changes that I need to make so that the C++ compiler will display warnings and terminate? I broke the build yesterday because I had not seen a warning that then showed up in the build.

I have these two options set in CMakeCache.txt:

//Enable compiler warnings.

//Fail and stop if a warning is triggered.

The latter should be sufficient.

It's possible that the buildbot is using a different compiler with
different warning implementations (& the LLVM CMake build does
enable/disable certain warnings on a per-compiler basis because of
inconsistencies in their implementations, or some of them being lower

Have you tried introducing some fairly "obvious" code that should
elicit a warning to see if your local build is identifying them?
Missing a return statement in a non-void-returning function should
probably be caught by nearly any compiler... (though maybe that's
-Werror by default in some compilers, so might not be the best
test)... not sure what the best example would be, unused variable,
perhaps? (just add a local variable to a function with no use of that

I introduced a variable in a class that was not referenced anywhere, which was the error I had in yesterday's build. My compiler was silent. I'll try your example.