It isn't CMake's job to do this. Just have it pass a flag to your compiler to use a custom pre-processor (--no-integrated-cpp -B<path>). Should work... hopefully. Might also have to pipe through the preprocessor again since OP's most likely won't be processing #includes and such