function(__print_package target)
  if(${target}_IS_DISABLED)
    logStatus(" ${Red}Disabled${ColourReset} : ${target}")
    logStatus("  *** why? ${${target}_WHY}")
  elseif(${target}_IS_LOADED OR TARGET ${target})
    logStatus("    ${Green}Found${ColourReset} : ${target}")
    if(${VERBOSE})
      logStatus(" ** package ${Blue}${target}${ColourReset}")
      string(TOUPPER ${target} name)
      if(${name}_INCLUDE_DIRS)
        logStatus("    Includes       : ${${name}_INCLUDE_DIRS}")
      endif()
      if(${name}_LIBRARIES)
        logStatus("    Libraries      : ${${name}_LIBRARIES}")
      endif()
      if(${name}_EXEC_PATH)
        logStatus("    Exec path      : ${${name}_EXEC_PATH}")
      endif()
      if(${name}_FLAGS)
        logStatus("    Flags          : ${${name}_FLAGS}")
      endif()
    endif()
  else()
    logStatus("${Red}Not found${ColourReset} : ${target}")
  endif()
endfunction()

function(printPackageInformations)

  get_property(TARGETS GLOBAL PROPERTY ${PROJECT_NAME}_TARGETS)
    
  foreach(target ${TARGETS})
    if(NOT ${target}_IMPORTED AND NOT ${target}_IS_META)
	  __print_package(${target})
	else()
	  list(APPEND imported ${${target}_IMPORTED})
	endif()
  endforeach()

  if(imported)
    list(REMOVE_DUPLICATES imported)

    foreach(import ${imported})
      logStatus("Imported from ${BoldMagenta}${import}${ColourReset}")
      foreach(target ${TARGETS})
        if(${target}_IMPORTED)
          if("${${target}_IMPORTED}" STREQUAL "${import}")
            __print_package(${target})
          endif()
        endif()
      endforeach()
    endforeach()
  endif()

  logStatus("Metas :")
  foreach(target ${TARGETS})
    if(${target}_IS_META)
      if(${target}_IS_DISABLED)
        logStatus(" ${Red}Disabled${ColourReset} : ${target}")
        logStatus("  *** why? ${${target}_WHY}")
      else()
	    logStatus("  ${Green}Defined${ColourReset} : ${target}")
	  endif()
	endif()
  endforeach()

endfunction()
