the files
  CMakeLists.txt
  gmsh_closest_points.cpp
correspond to 
gmsh-2.6.1-source
they should go into
gmsh-2.6.1-source/utils/api_demos/

They are subject to the same license as gmsh, see
  http://geuz.org/gmsh/
.

this can be build with cmake there.
so far only the dynamically linked version works:
make gmsh_closest_points_shared
cp ./gmsh_closest_points_shared  ~/bin/gmsh_closest_points


For many of our examples it is important to have OpenCASCADE support enabled in gmsh. To work with gmsh with non-system wide OpenCASCADE installation, use 

 export LD_LIBRARY_PATH=$HOME/bin/OpenCASCADE654/lib64/:$LD_LIBRARY_PATH
 cmake ../../../utils/api_demos/ -DENABLE_FLTK=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DOCC_INC=$HOME/bin/OpenCASCADE654/inc -DCMAKE_LIBRARY_PATH=$HOME/bin/OpenCASCADE654/lib64



