add support for optional error messages

added the CMake #ifdef option for error messages with and without the
format