Cmake warnings as error

I am trying to stop cmake from continuing generation if it outputs a warning, i.e. treat all warnings as errors and stop.
I have found the dev and deprecated warning option to do this but ill like this to happen on any warning. e.g. i have sometimes unused variables/options which outputs a cmake warning, to prevent anyone from passing unused variables to the generation i like to enable such an option.

Anyone know how to do this?

Perhaps you want CMAKE_ERROR_DEPRECATED?

cmake ... -D CMAKE_ERROR_DEPRECATED=ON

I am looking for a more general option, something like: CMAKE_WARN_AS_ERROR. the deprecated error/warning only stops on that type. Sometimes you pass an unused variable to cmake and that would output a warning which i like to prevent. if you do:

cmake -DMY_UNUSED_VAR=true

it will output

“CMake Warning: Manually-specified variables were not used by the project: MY_UNUSED_VAR”

I would like to make that warning an error, any any other CMake Warning.