[CMake] Use CMake to determine HAVE_* defines