# currently unused
# PROCESS_TARGET_DEFAULT_PROPERTIES sets default target properties that are valid across Tart
FUNCTION(PROCESS_TARGET_DEFAULT_PROPERTIES PACKAGE_TARGET ENTRIES ENTRY_INDENTS)
  GET_ENTRY_VALUES("package_path" "${ENTRIES}" "${ENTRY_INDENTS}" PACKAGE_PATH HAS_SUBTREE)
  GET_ENTRY_VALUES("package_version" "${ENTRIES}" "${ENTRY_INDENTS}" PACKAGE_VERSION HAS_SUBTREE)
  IF("${PACKAGE_VERSION}" STREQUAL "")
    TART_WARNING("No version found for package ${PACKAGE_TARGET}.")
  ELSE()
    SET(PACKAGE_VERSION "${PACKAGE_VERSION}/")
  ENDIF()
  SET_TARGET_PROPERTIES(${PACKAGE_TARGET} PROPERTIES
    DEBUG_POSTFIX "_debug"
    LIBRARY_OUTPUT_DIRECTORY ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    ARCHIVE_OUTPUT_DIRECTORY ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    RUNTIME_OUTPUT_DIRECTORY ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
    RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
  )
ENDFUNCTION(PROCESS_TARGET_DEFAULT_PROPERTIES)

# PROCESS_TARGET_DEFAULT_COMPILE_DEFINITIONS() Process default compile definition list 
#
FUNCTION(PROCESS_TARGET_DEFAULT_COMPILE_DEFINITIONS PACKAGE_TARGET ENTRIES ENTRY_INDENTS)
  GET_ENTRY_VALUES("package_path" "${ENTRIES}" "${ENTRY_INDENTS}" PACKAGE_PATH HAS_SUBTREE)
  # TODO write a getPackageVersion function
  IS_DIR_GIT_REPO(${PACKAGE_PATH} DIR_IS_GIT_REPO)
  IF(${DIR_IS_GIT_REPO})
    GET_LAST_GIT_TAG("${PACKAGE_PATH}" GIT_TAG)
    TART_DEBUG("Setting compile def TART_PACKAGE_VERSION=${GIT_TAG}")
    TARGET_COMPILE_DEFINITIONS(${PACKAGE_TARGET} PRIVATE "TART_PACKAGE_VERSION=\"${GIT_TAG}\"")
  ENDIF()
ENDFUNCTION(PROCESS_TARGET_DEFAULT_COMPILE_DEFINITIONS)
