Added CMake support à la https://gitorious.org/libdai/libdai/commits/5a6...

This guy adds CMake support to libDAI:

https://gitorious.org/libdai/libdai/commits/5a6703ee94a3fbd4e4f0e400e9491d82ebc6ac52

I've pulled his CMake related changes into this repo.