I port games amongst cell phone handsets; part of the testing is building a DLL that runs on a PC-based emulator. Each game has several source files. I also have a file from the SDK I need to include with each build. I have two SDK versions. So I need either c:/vendor/version_1/src/foo.c or c:/vendor/version_2/src/foo.c. Foo.c never changes, so I want to build it out of the vendor's SDK distribution.
I also need to include header files from either c:/vendor/version_1/inc, or c:/vendor/version_2/inc.
Right now I have one solution per game, with several configurations to deal with the handsets. It works very well except for that pesky foo.c file.
Ideally, I'd like to have a single variable, $(VERSION) or some such, and key the SRC and INC directories off this. If that isn't possible, can I somehow have multiple source file listed in a single solution?
If all else fails, I can use a pre-build rule to copy the foo.c file to the local directory, and a post build rule to delete the silly thing. This seems, well, silly.
Here's an idea: why not create a file in your project called MYFOO.C that only consists of a single line that looks like this:
#include <foo.c>Then, each configuration has a different include directory for foo.c based on the version (which you already do for the header files).
This was first published in May 2004