# mdiConfig.cmake
# --------------------
#
# MDI_Library cmake module.
# This module sets the following variables in your project::
#
#   mdi_FOUND - true if MDI_Library and all required components found on the system
#   mdi_VERSION - MDI_Library version in format Major.Minor.Release
#   mdi_INCLUDE_DIRS - Directory where MDI_Library header is located.
#   mdi_INCLUDE_DIR - same as DIRS
#   mdi_LIBRARIES - MDI_Library library to link against.
#   mdi_LIBRARY - same as LIBRARIES
#
#
# Exported targets::
#
# If the MDI_Library is found, this module defines the following :prop_tgt:`IMPORTED`
# target. Target is shared _or_ static, so, for both, use separate, not
# overlapping, installations. ::
#
#   mdi::mdi - the main MDI library with header attached.
#
#
# Suggested usage::
#
#   find_package(mdi)
#   find_package(mdi 1.0.1 EXACT CONFIG REQUIRED)

@PACKAGE_INIT@

set(PN mdi)

if(@BUILD_SHARED_LIBS@)
    set(${PN}_shared_FOUND 1)
else()
    set(${PN}_static_FOUND 1)
endif()

check_required_components(${PN})

#-----------------------------------------------------------------------------
# Don't include targets if this file is being picked up by another
# project which has already built this as a subproject
#-----------------------------------------------------------------------------
if(NOT TARGET ${PN}::mdi)
    include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")

    get_property(_loc TARGET ${PN}::mdi PROPERTY LOCATION)
    set(${PN}_LIBRARY ${_loc})
    get_property(_ill TARGET ${PN}::mdi PROPERTY INTERFACE_LINK_LIBRARIES)
    set(${PN}_LIBRARIES ${_ill})

    get_property(_id TARGET ${PN}::mdi PROPERTY INCLUDE_DIRECTORY)
    set(${PN}_INCLUDE_DIR @CMAKE_INSTALL_PREFIX@/@MDI_INSTALL_INCLUDEDIR@)
    get_property(_iid TARGET ${PN}::mdi PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
    set(${PN}_INCLUDE_DIRS ${_iid})
endif()
