One of the great things about having a weblog and living your (professional) life through it is the incredible amount of help that you can get with your problems. Within a few hours of posting my entry on creating C++ build scripts with NAnt, I got messages from Tomas Restrepo and John Robbins that helped me solve my problems with precompiled headers.
John summarized the solution the best:
- Use /Yc on the STDAFX.CPP file.
- Use /Yu on all other .CPP files.
Fortunately, these rules are really easy to capture using the cl task in NAnt:
`
Tomas helped out with a pointer to NAntContrib, which is where the community is dropping additional tasks into SourceForge. I downloaded RcTask.cs, which is a task that contains support for calling rc.exe. This lets me write:
<rc rcfile='Weaver.rc' output='${build}\Weaver.res' options='/d "_DEBUG" /l 0x409 /I "${build}"'/>
to compile my resource scripts. What RcTask is missing, however, is dependency checking. I’ll look into adding that support later tonight.
I’ve updated my simple ATL build script to reflect my newfound understanding. You can click here to download it.