add back support for applying local patches
patch CMake to make the non-Cern branch happy with clang

  by bstegmaier75,
  from: https://github.com/mangelajo/KicadOSXBuilder/issues/14#issuecomment-29023516
fix misformatting in CMake patch, oopsie
allow re-building with patches without cleanup

   If first attempt to patch fails, try reverting and re-applying the
   patch.
Merge pull request #19 from nikodemus/master

bstegmaier75's fix for the build issues in the mainline branch