nmathewson/Libevent — pull request #88 by JoakimSoderberg (2013-12-13 17:04:12+00:00)
Title: CMake project for Libevent

# CMake project!

I've been using CMake to build Libevent for quite some time now, since the current Windows build system didn't do it for me.

I based the project on an old implementation I found that was discussed in the mailinglist from 2010:
http://archives.seul.org/libevent/users/May-2010/msg00028.html

Which also was considered to be added:
_"This looks like something worth considering for Libevent 2.1"_
http://www.mail-archive.com/libevent-users@seul.org/msg00224.html

But it seems to have run out in the sand and never happened. I contacted Brodie Thiesfield and he didn't even use the CMake project mentiond in the mail thread.

Anyway, enough history. I've updated the CMake project a bunch, adding more features now available in the autotools project. I don't propose replacing the current autotools solution, but having this mainly for Windows. But still having a fully working option for most Unixen.

## Some highlights:
- I update the test suite to behave as the test*.sh shell scripts (running the tests with only one backend at a time set using environment variables), but in a fully CMake fashion, so that they can be run consistenly on both Windows and Unix. Currently however, one of the regress tests fail on Windows, mentiond in issue #90. At least from my tests it passes 100% on Linux. I will test later on OSX as well.
- Added more command line options that does the same things as the autotools project.
- Updated and added more system introspection to match what autotools checks for.

## Some caveats (this can be changed ofcourse):
- I removed the empty evconfig-private.h in the WIN32-Code directory. This will break the current nmake Makefile, so if that's something you still want to keep, that must be fixed in another way.
- Also removed the hard coded WIN32-Code/include/event2/event-config.h since it will be autogenerated with the CMake project as well.

## Compiling using CMake and running tests (unix):

```
git clone ....
cd Libevent
mkdir build
cd build
cmake ..
make
ctest
```

## On windows (Visual studio):

```
cmake -G "Visual Studio 10" .. # Or whatever generator you wish to use ofcourse, cmake --help for a list
start libevent.sln
```

Build the entire solution and then build the RUN_TESTS project.

Please consider adding this. I'm willing to change it to accomodate to any wishes you might have before merging ofcourse. CMake support simply adds a lot more alternatives when it comes to development environments, making it possilbe to generate build files for Visual Studio, Eclipse, Make, Sublime Text and much more.