More cmake improvements.

Turns out, the C code depends on openmp header for no apparent reason, so I added detection of openmp to cmake.