Check for sys/stat.h when building with cmake

While we checked for sys/stat.h when building with the GNU toolchain,
this check was missing in the cmake configuration, and HAVE_SYS_STAT_H
was accordingly never set, whether the header file was present or not.