BTW: This code:
// NOT USED: #cmakedefine HAVE_ZLIB 1
gets expanded to:
// NOT USED: #define HAVE_ZLIB 1
(if HAVE_ZLIB is true, obviously)
which I think is at least inconsistent because the leading ‘// comment
’ is NOT removed - and removing it would in all cases lead to unexpected behavior.
My suggestion would be to not expand #cmakedefine
at all if it’s not the first token (after optional whitespace) in a source line.