Cleaning up CMake files and fixing warnings on VS builds.