CMake: MSVC12 support & Foreach Fix

Added support for VS 2013 in and fixed broken foreach in examples.

Tested on Windows 7 with CMake 2.8.12.2.