I have attached a patch which adds cmake build system support to C-Ares.
The patch does not modify any source files, it only adds 3 new files
(CMakelists.txt, ares_build.h.cmake, ares_config.h.cmake) which form the
build system. I've tried to go through as much of the autotools tests and
extracted what I thought was appropriate, though many of the tests aren't
as in-depth in CMake as they are for autotools ... it is unclear why some
of them exist at all, I'm guessing for legacy systems that CMake probably
doesn't support anyhow.
Building the library, and examples (adig, ahost, acountry) plus installation
should work. The tests have not yet been integrated. I'm hoping this can
be improved on by others for platforms I do not have access to.
My motivation for doing this is I maintain some projects that use c-ares
and chain build it as part of the build rather than referencing it as an
external library. The autotools project didn't integrate very well with
cmake, and quite frankly, it took longer for configure to finish (due to
argument detection of recv, recvfrom, and send -- which I've eliminated
in cmake with some "educated guesses" that seem to work well) than for all
of CMake and the entire build process to run for the projects.
The CMake build system for C-Ares has been tested on the below platforms
* Windows x86/x64 MinGW-w64/MSYS2
* Windows x86/x64 Visual Studio 2005
* Linux x86/x64 (CentOS 5, Ubuntu 14.04 [GCC, Clang])
* FreeBSD 9 x86 (GCC)
* FreeBSD 10 x64 (clang)
* Solaris 10 x64 (GCC)
* Solaris 10 Sparc 32/64 (GCC)
* AIX 5.3 POWER 32/64 (GCC)
* MacOSX 10.11 (clang)
Please let me know if there are any questions/comments/concerns.
Received on 2016-06-28