# This module defines
#
#   ONLYOFFICE_FOUND
#   ONLYOFFICE_LIBRARIES
#   ONLYOFFICE_INCLUDE_DIRS


find_path(ONLYOFFICE_INCLUDE_DIR NAMES
  onlyoffice/Common/OfficeDefines.h
  onlyoffice/XlsxSerializerCom/Common/Common.h
  onlyoffice/ASCOfficeDocxFile2/DocWrapper/DocxSerializer.h
  onlyoffice/ASCOfficePPTXFile/ASCOfficePPTXFile.h
)

find_library(ONLYOFFICE_LIBRARY NAMES onlyoffice)
find_library(ONLYOFFICE_LIBRARY_DESKTOP NAMES onlyofficedesktop)
find_library(ONLYOFFICE_LIBRARY_DOCX2 NAMES onlyofficedocx2)
find_library(ONLYOFFICE_LIBRARY_PPTX NAMES onlyofficepptx)
find_library(ONLYOFFICE_LIBRARY_SER NAMES onlyofficeser)
find_library(ONLYOFFICE_LIBRARY_UTILS NAMES onlyofficeutils)

find_package_handle_standard_args(OnlyOffice DEFAULT_MSG
  ONLYOFFICE_LIBRARY
  ONLYOFFICE_INCLUDE_DIR
  ONLYOFFICE_LIBRARY_DESKTOP
  ONLYOFFICE_LIBRARY_DOCX2
  ONLYOFFICE_LIBRARY_PPTX
  ONLYOFFICE_LIBRARY_SER
  ONLYOFFICE_LIBRARY_UTILS
)

if(ONLYOFFICE_FOUND)
  set(ONLYOFFICE_LIBRARIES
    ${ONLYOFFICE_LIBRARY}
    ${ONLYOFFICE_LIBRARY_DESKTOP}
    ${ONLYOFFICE_LIBRARY_DOCX2}
    ${ONLYOFFICE_LIBRARY_PPTX}
    ${ONLYOFFICE_LIBRARY_SER}
    ${ONLYOFFICE_LIBRARY_UTILS}
  )
endif()

mark_as_advanced(
  ONLYOFFICE_LIBRARY_DESKTOP
  ONLYOFFICE_LIBRARY_DOCX2
  ONLYOFFICE_LIBRARY_PPTX
  ONLYOFFICE_LIBRARY_SER
  ONLYOFFICE_LIBRARY_UTILS
)
