Fix regex to expressly check for starting ., and switch to regex match for SH lines to stop any potential problems with training spaces or multiple spaces before section name.
The install is equivalent to the autoconf install with no options.
Note that where the autoconf adds copies of manual pages renamed to individual APIs via a script manpgaltnames (in doc), this functionality is now done in pure CMake, to ensure it works on Windows.
Also note there is no 'make uninstall'. See https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake.
* I can't find out where the .so version number currently produced by the autoconf build comes from, so for the moment supply it explicitly.
* Include a version in the Windows DLL. But Windows can only grok major[.minor]. So also supply one of those.
* On Windows, we need a .lib for the .dll, and a static .lib. These, obviously, need different names. So add _static onto the name of the static lib.
* Only build the objects once, so explicitly build both with PIC.
* Only export the explicit list of symbols from the shared library. This has to be done a different way on GNU ld, Mac linker and Windows.
* Although I have left the tools being linked statically, I have tested with dynamic linking. getdns_query uses gettimeofday(), which isn't on Windows. With a static link, it just happens to find it in the getdns library, as the symbols aren't filtered. But this doesn't work for shared use, when they are. So explicitly add the compat implementation into the getdns_query sources.
This is just a basic build of the library. No options are support, and the only builds tested are Xenial and MacOS (the latter using the Brew openssl package, and so requiring -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2l option on the cmake command line).
Using the library is untested.