Correct CMake variable name, and provide minor/major/compat information to the preprocessor. Fix the deprecated error constants.