Add kqueue support and use CMake to check system