# SET_PACKAGE_HEADER_FILES() Set header pathes according to tart.yaml file
# 
FUNCTION(SET_PACKAGE_HEADER_FILES PACKAGE_NAME PACKAGE_DIR ENTRIES ENTRY_INDENTS)
  TART_DEBUG("Setting package headers")
  # TODO: if entry is file, add its parent folder
  
  # Private headers
  SET(PACKAGE_PRIVATE_HEADERS "")
  GET_ENTRY_VALUES("private_headers" "${ENTRIES}" "${ENTRY_INDENTS}" PACKAGE_PRIVATE_HEADERS HAS_SUBTREE)
  
  # Setting header to absolute pathes
  SET(PRIVATE_HEADERS "")
  FOREACH(HEADER_PATH ${PACKAGE_PRIVATE_HEADERS})
    LIST(APPEND PRIVATE_HEADERS "${PACKAGE_DIR}/${HEADER_PATH}")
  ENDFOREACH()
  IF(NOT "${PRIVATE_HEADERS}" STREQUAL "")
    TART_DEBUG("  with private headers: \n               ${PRIVATE_HEADERS}")
  ENDIF()
  TARGET_INCLUDE_DIRECTORIES(${PACKAGE_NAME} PRIVATE "${PRIVATE_HEADERS}")
    
  # Public headers
  SET(PACKAGE_PUBLIC_HEADERS "")
  GET_ENTRY_VALUES("include" "${ENTRIES}" "${ENTRY_INDENTS}" INCLUDE_DIRS HAS_SUBTREE)
  LIST(APPEND PACKAGE_PUBLIC_HEADERS "${INCLUDE_DIRS}")
  GET_ENTRY_VALUES("include_dir" "${ENTRIES}" "${ENTRY_INDENTS}" INCLUDE_DIRS HAS_SUBTREE)
  LIST(APPEND PACKAGE_PUBLIC_HEADERS "${INCLUDE_DIRS}")
  GET_ENTRY_VALUES("public_headers" "${ENTRIES}" "${ENTRY_INDENTS}" INCLUDE_DIRS HAS_SUBTREE)
  LIST(APPEND PACKAGE_PUBLIC_HEADERS "${INCLUDE_DIRS}")
  GET_ENTRY_VALUES("headers" "${ENTRIES}" "${ENTRY_INDENTS}" INCLUDE_DIRS HAS_SUBTREE)
  LIST(APPEND PACKAGE_PUBLIC_HEADERS "${INCLUDE_DIRS}")
  
  # Setting header to absolute pathes
  SET(PUBLIC_HEADERS "")
  FOREACH(HEADER_PATH ${PACKAGE_PUBLIC_HEADERS})
    LIST(APPEND PUBLIC_HEADERS "${PACKAGE_DIR}/${HEADER_PATH}")
  ENDFOREACH()
  IF(NOT "${PUBLIC_HEADERS}" STREQUAL "")
    TART_DEBUG("  with public headers: \n               ${PUBLIC_HEADERS}")
  ENDIF()
  TARGET_INCLUDE_DIRECTORIES(${PACKAGE_NAME} PUBLIC "${PUBLIC_HEADERS}")
  
  # Interface headers
  GET_ENTRY_VALUES("interface_headers" "${ENTRIES}" "${ENTRY_INDENTS}" PACKAGE_INTERFACE_HEADERS HAS_SUBTREE)
  
  # Setting header to absolute pathes
  SET(INTERFACE_HEADERS "")
  FOREACH(HEADER_PATH ${PACKAGE_INTERFACE_HEADERS})
    LIST(APPEND INTERFACE_HEADERS "${PACKAGE_DIR}/${HEADER_PATH}")
  ENDFOREACH()
  IF(NOT "${INTERFACE_HEADERS}" STREQUAL "")
    TART_DEBUG("  with interface headers: \n               ${INTERFACE_HEADERS}")
  ENDIF()
  TARGET_INCLUDE_DIRECTORIES(${PACKAGE_NAME} INTERFACE "${INTERFACE_HEADERS}")
ENDFUNCTION(SET_PACKAGE_HEADER_FILES)
