# TelepathyQt@QT_VERSION_MAJOR@Config.cmake is generated by CMake from TelepathyQt/TelepathyQtConfig.cmake.in.
# Any changed value in this file will be overwritten by CMake.

if(NOT TelepathyQt@QT_VERSION_MAJOR@_FOUND)

    @PACKAGE_INIT@

    # set the version number
    set(TELEPATHY_QT@QT_VERSION_MAJOR@_VERSION_MAJOR @TP_QT_MAJOR_VERSION@)
    set(TELEPATHY_QT@QT_VERSION_MAJOR@_VERSION_MINOR @TP_QT_MINOR_VERSION@)
    set(TELEPATHY_QT@QT_VERSION_MAJOR@_VERSION_MICRO @TP_QT_MICRO_VERSION@)
    set(TELEPATHY_QT@QT_VERSION_MAJOR@_VERSION_NANO @TP_QT_NANO_VERSION@)
    set(TELEPATHY_QT@QT_VERSION_MAJOR@_VERSION @PACKAGE_VERSION@)

    # Find the dependencies
    include(CMakeFindDependencyMacro)

    # Base Qt components set
    set(_QT_COMPONENTS Core DBus Network)

    if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.9)
        find_dependency(Qt5 @QT_MINUMUM_VERSION@ COMPONENTS ${_QT_COMPONENTS})
    else()
        # Old CMake versions do not support COMPONENTS in find_dependency
        foreach(_QT_MODULE ${_QT_COMPONENTS})
            find_dependency(Qt5${_QT_MODULE} @QT_MINUMUM_VERSION@)
        endforeach()
    endif()
    unset(_QT_COMPONENTS)

    # attempt to find the generated Targets file in the same directory
    get_filename_component(_TPQT@QT_VERSION_MAJOR@_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
    find_file(_TPQT@QT_VERSION_MAJOR@_TARGETS_FILE TelepathyQt@QT_VERSION_MAJOR@Targets.cmake PATHS ${_TPQT@QT_VERSION_MAJOR@_CONFIG_DIR} NO_DEFAULT_PATH)

    include(${_TPQT@QT_VERSION_MAJOR@_TARGETS_FILE})

    set(_TelepathyQt@QT_VERSION_MAJOR@_NOTFOUND_MESSAGE)
    set(_WANTED_COMPONENTS "${TelepathyQt@QT_VERSION_MAJOR@_FIND_COMPONENTS}")
    list (FIND _WANTED_COMPONENTS "Core" _CORE_INDEX)
    if (${_CORE_INDEX} LESS 0)
        list(APPEND _WANTED_COMPONENTS Core)
    endif()
    foreach(_MODULE ${_WANTED_COMPONENTS})
        if(NOT TARGET TelepathyQt@QT_VERSION_MAJOR@::${_MODULE})
            if (TelepathyQt@QT_VERSION_MAJOR@_FIND_REQUIRED_${_MODULE})
                set(_TelepathyQt@QT_VERSION_MAJOR@_NOTFOUND_MESSAGE
                    "${_TelepathyQt@QT_VERSION_MAJOR@_NOTFOUND_MESSAGE}Failed to find TelepathyQt@QT_VERSION_MAJOR@ component \"${_MODULE}\"\n")
            elseif(NOT TelepathyQt@QT_VERSION_MAJOR@_FIND_QUIETLY)
                message(WARNING "Failed to find TelepathyQt@QT_VERSION_MAJOR@ component \"${_MODULE}\"")
            endif()
        endif()
    endforeach()

    if (_TelepathyQt@QT_VERSION_MAJOR@_NOTFOUND_MESSAGE)
        set(TelepathyQt@QT_VERSION_MAJOR@_NOT_FOUND_MESSAGE "${_TelepathyQt@QT_VERSION_MAJOR@_NOTFOUND_MESSAGE}")
        set(TelepathyQt@QT_VERSION_MAJOR@_FOUND False)
    endif()

    # Legacy stuff for old-style import

    # set the LIBRARIES variable
    get_target_property(TELEPATHY_QT@QT_VERSION_MAJOR@_LIBRARIES
        TelepathyQt@QT_VERSION_MAJOR@::Core
        IMPORTED_LOCATION
    )

    if(NOT TELEPATHY_QT@QT_VERSION_MAJOR@_LIBRARIES)
        # If there is no default IMPORTED_LOCATION then get all configurations...
        get_target_property(_IMPORTED_CONFIGURATIONS
            TelepathyQt@QT_VERSION_MAJOR@::Core
            IMPORTED_CONFIGURATIONS
        )
        # ... and pick up the first one
        list(GET _IMPORTED_CONFIGURATIONS 0 _SELECTED_CONFIGURATION)
        get_target_property(TELEPATHY_QT@QT_VERSION_MAJOR@_LIBRARIES
            TelepathyQt@QT_VERSION_MAJOR@::Core
            IMPORTED_LOCATION_${_SELECTED_CONFIGURATION}
        )
        unset(_IMPORTED_CONFIGURATIONS)
        unset(_SELECTED_CONFIGURATION)
    endif()

    get_target_property(TELEPATHY_QT@QT_VERSION_MAJOR@_INCLUDE_DIR
        TelepathyQt@QT_VERSION_MAJOR@::Core
        INTERFACE_INCLUDE_DIRECTORIES
    )
endif()
