I have a very large codebase (read: thousands of modules) that has code shared across numerous projects that all run on different operating systems with different C++ compil
You could have a pre-build step run that generates an include file that contains a list of #defines that represent the names of the files existing in the current directory:
#define EXISTS_FILE1_C
#define EXISTS_FILE1_H
#define EXISTS_FILE2_C
Then, include that file from within your source code, and then your source can test the EXISTS_*
defines to see whether a file exists or not.