Spatial libraries fixed

When building [libosmium](https://github.com/osmcode/libosmium) examples under MSYS2 I noticed some bugs in newly added spatial packages (libspatialite, gdal and geos). Th edetailed descriptions are in comments.
This is my patch for geos cmake build system with MINGW (proper detection of isnan and correct installation of geos-config).
Switching to cmake build system from autotools is needed because C++ .dll libraries were incorrectly generated (and I have no knowledge to fix that build system scripts). Detected when compiling libosmium (C++ 11).