Use ${GENERATOR:+-G "$GENERATOR"} instead of "$GENERATOR_FLAG" "$GENERATOR".