Switch to CMake

I've tested on Linux, OSX and Cygwin, but please help with testing your favorite configurations and report any issues found.

This change provides a configure wrapper script to make it almost backwards compatible with the old build system. See `configure --help` for details.

What comes to the build flags, it's not 100% identical with the old ones. Some of the platform specific build flags collected over the last decade were intentionally left behind. The latest ZNC requires a modern toolchain that supports C++11 anyway, so many of those old exotic flags are probably no longer even needed. The idea is to let CMake as a cross-platform to specify the correct flags, mostly.

The proposal also changes the structure a bit. After struggling with the damn object files for a good while, I decided to propose building the core as a library instead, like it was already done on Cygwin. I strongly believe this is the right direction to go in the future (see #210 and [Wiki](http://wiki.znc.in/Ideas)).

/cc @samuelgaist
Hm, gotta love cmake... Is it really better than autotools? :(

2014-09-18 22:31 GMT+01:00 J-P Nurmi <notifications@github.com>:

> In .travis.yml:
>
> >        global:
> >            - secure: "i2f2UVDnyHT/9z0U3XvgTj8eDERvnc1Wk7HpseEjb75JwGzqn/2R+RKHmoSrwK3hFgij2IMxZL19XtHFwMz9t5A/huAAKD74KMMI/QpeZEJ/sjT3CTLcE9HEVDdJOjc7dfLRxb2hZtgvx8clZIMrpeUdPhci8openff30KvXVbg="
> >  matrix:
> >      include:
> >          - compiler: clang
> > -          env: CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=address -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fPIE" MYLDFLAGS="-fsanitize=address -pie"
> > +          env: CFGFLAGS=--debug MYCXXFLAGS="-fsanitize=address -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fPIE" MYCFLAGS="-fsanitize=address -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fPIE" MYLDFLAGS="-fsanitize=address -pie"
>
> It's how CMake's check_function_exists(), check_library_exists(),
> check_symbol_exists() are implemented. Those are used in
> DefineBuildFlags.cmake. It's probably possible to replace them with
> check_cxx_source_compiles() or try_compile(), but it's going to get
> cumbersome...
> … <#1488aad0a0ff68d0_>
> -- J-P Nurmi
>  On 18 Sep 2014, at 23:00, Alexey Sokolov <notifications@github.com>
> wrote: In .travis.yml: > global: > - secure:
> "i2f2UVDnyHT/9z0U3XvgTj8eDERvnc1Wk7HpseEjb75JwGzqn/2R+RKHmoSrwK3hFgij2IMxZL19XtHFwMz9t5A/huAAKD74KMMI/QpeZEJ/sjT3CTLcE9HEVDdJOjc7dfLRxb2hZtgvx8clZIMrpeUdPhci8openff30KvXVbg="
> > matrix: > include: > - compiler: clang > - env: CFGFLAGS=--enable-debug
> MYCXXFLAGS="-fsanitize=address -O1 -fno-omit-frame-pointer
> -fno-optimize-sibling-calls -fPIE" MYLDFLAGS="-fsanitize=address -pie" > +
> env: CFGFLAGS=--debug MYCXXFLAGS="-fsanitize=address -O1
> -fno-omit-frame-pointer -fno-optimize-sibling-calls -fPIE"
> MYCFLAGS="-fsanitize=address -O1 -fno-omit-frame-pointer
> -fno-optimize-sibling-calls -fPIE" MYLDFLAGS="-fsanitize=address -pie" Why
> those checks are done with C compiler instead of C++ compiler? 2014-09-18
> 21:45 GMT+01:00 J-P Nurmi <notifications@github.com>: … — Reply to this
> email directly or view it on GitHub.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/znc/znc/pull/648/files#r17756353>.
>