Add 5.2 compatability.

Added the compatibility layer like you requested (but didn't test that the generated sources compile with 5.1 or 5.0 since I don't use those versions).