Make the flex auto generation code conditional on CMake build (depends on -DWITH_FLEX=1)