def get_current_spec_list(ctx):
    """
    Get the current spec list, either from -p/--project-specs or --specs-to-include-in-project-generation or
    specs_to_include_in_project_generation in user_settings.options
    :param ctx: Current context
    :return: The current spec list
    """
    try:
        return ctx.current_spec_list
    except AttributeError:
        pass

    # Get either the current spec being built (build) or all the specs for the solution generation (configure/msvs)
    current_spec = getattr(ctx.options, 'project_spec')
    if not current_spec:
        # Specs are from 'specs_to_include_in_project_generation'
        spec_string_list = getattr(ctx.options, 'specs_to_include_in_project_generation', '').strip()
        if len(spec_string_list) == 0:
            ctx.fatal(
                "[ERROR] Missing/Invalid specs ('specs_to_include_in_project_generation') in user_settings.options")
        spec_list = [spec.strip() for spec in spec_string_list.split(',')]
        if len(spec_list) == 0:
            ctx.fatal("[ERROR] Empty spec list ('specs_to_include_in_project_generation') in user_settings.options")
    else:
        spec_list = [current_spec]

    # Vet the list and make sure all of the specs are valid specs
    for spec in spec_list:
        if not ctx.is_valid_spec_name(spec):
            ctx.fatal(
                "[ERROR] Invalid spec '{}'.  Make sure it exists in the specs folder and is a valid spec file.".format(
                    spec))

    ctx.current_spec_list = spec_list
    return ctx.current_spec_list