cmake: add checks to generate folly-config.h correctly