Rather than using .gitignore to mask source tree pollution, add basic checks to the CMake file to prevent in-source builds. See http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees