Fixing warning MSB8029 with CMake and MSVC12

This week I fixed a bunch of warnings on the Humm and Strumm nightly build Windows machine that didn’t actually relate to our code, but instead our build system.  We use a CMake build system with (what I think is) a relatively standard out-of-source build pattern.  On the nightly machine, though, when the engine was built using “cmake –build”, we’d see 16 of the following warnings:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(389,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build.

This warning is a useful warning in many cases, where an incremental build could speed up build times, but since we clear the build directory every night on our virtual machines, we can’t do an incremental build.  Even worse, since this is the way CMake builds are structured, we can’t easily turn the warning off.

Googling, I found almost no answers, until I came across this question on MSDN.  Apparently, if you add <IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> to the macros section of your Microsoft.Cpp.x64.user and Microsoft.Cpp.Win32.user files that are hidden away under %LOCALAPPDATA%\Microsoft\MSBuild\v4.0\, these warnings will be globally ignored.  In my case, since this machine only does nightly builds, and will never do incremental builds, that’s a pretty good solution.

I hope if anyone else runs into this problem, this will be helpful.