set(_blast_supported_components "shared" "static")

if(blast_FIND_COMPONENTS)
    foreach(_comp ${blast_FIND_COMPONENTS})
        if(NOT _comp IN_LIST _blast_supported_components)
            set(blast_FOUND False)
            set(blast_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
        endif(NOT _comp IN_LIST _blast_supported_components)

        include("${CMAKE_CURRENT_LIST_DIR}/blast-${_comp}.cmake"
            OPTIONAL
            RESULT_VARIABLE _comp_loaded)

        if(NOT _comp_loaded)
            set(blast_FOUND False)
            set(blast_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
        else(NOT _comp_loaded)
            set(blast_${_comp}_FOUND TRUE)
        endif(NOT _comp_loaded)
    endforeach(_comp ${blast_FIND_COMPONENTS})
else(blast_FIND_COMPONENTS)
    foreach(_component_config IN LISTS _blast_supported_components)
        include("${CMAKE_CURRENT_LIST_DIR}/blast-${_component_config}.cmake"
                OPTIONAL)
    endforeach(_component_config IN LISTS _blast_supported_components)

    if(NOT TARGET BLAST::BLAST)
        set(blast_FOUND False)
        set(blast_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
        string(APPEND blast_NOT_FOUND_MESSAGE "build blast with support for shared libs or\n")
        string(APPEND blast_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
    endif(NOT TARGET BLAST::BLAST)

    if(NOT TARGET BLAST::BLASTSTATIC)
        set(blast_FOUND False)
        set(blast_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
        string(APPEND blast_NOT_FOUND_MESSAGE "build blast with support for static libs or\n")
        string(APPEND blast_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
    endif(NOT TARGET BLAST::BLASTSTATIC)
endif(blast_FIND_COMPONENTS)
