MAKE_TERMOUT environment variable causes a number of CMake generated variables to not be set correctly

I suspect this was caused by the same problem fixed by CMake MR 11080.