CMake build system - cleaned 

CMake build system from #442. I squashed commits and cleaned the history for easier merging.

I also added LMDB support as in #571 (@kloudkl I hope you won't hold it against me)

Building tips:
```
mkdir build
cd build
CC=gcc-4.6 cmake ..
make
ctest -v
```
(Not sure if `CC=gcc-4.6` is neccesary, but no other version works for me)

Options are specified at cmake invokation with `-D` flag as in `cmake -DBUILD_PYTHON=ON ..`
- `BUILD_PYTHON` [default `OFF`]
- `BUILD_MATLAB` [default `OFF`]
- `BUILD_EXAMPLES` [default `ON`]
- `BLAS` [`atlas, open, mkl`; default `atlas`]
- `BUILD_SHARED_LIBS` [default `OFF`]
- `CUDA_TEST_DEVICE` [default `0`]

Remarks:
- Tested only under Linux Mint 16
Binaries require system installed libproto.so