cmake: add NetBSD support / complete cmake support

Tested on a virtual NetBSD 6.0.

Now we should support the same platforms for
autotools and cmake.