# Defines variables:
# - OGRE_INCLUDE_DIRS
# - OGRE_LIBRARIES
# - OGRE_PLUGIN_DIR

set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:$ENV{OGRE_HOME}/lib/pkgconfig")
find_package(PkgConfig)
pkg_check_modules(OGRE_PKGCONF QUIET OGRE)

find_path(OGRE_INCLUDE_DIR
  NAMES Ogre.h
  HINTS ${OGRE_PKGCONF_INCLUDEDIR} ${OGRE_PKGCONF_INCLUDE_DIRS} $ENV{OGRE_HOME}/include
  PATH_SUFFIXES OGRE
)

find_library(OGRE_LIBRARY
  NAMES OgreMain
  HINTS ${OGRE_PKGCONF_LIBDIR} ${OGRE_PKGCONF_LIBRARY_DIRS} $ENV{OGRE_HOME}/lib
)

find_library(OGRE_PBS_LIBRARY
  NAMES OgreHlmsPbs
  HINTS ${OGRE_PKGCONF_LIBDIR} ${OGRE_PKGCONF_LIBRARY_DIRS} $ENV{OGRE_HOME}/lib
)

find_library(OGRE_UNLIT_LIBRARY
  NAMES OgreHlmsUnlit
  HINTS ${OGRE_PKGCONF_LIBDIR} ${OGRE_PKGCONF_LIBRARY_DIRS} $ENV{OGRE_HOME}/lib
)

find_path(OGRE_PLUGIN_DIR
  NAMES RenderSystem_GL3Plus.so
  HINTS ${OGRE_PKGCONF_LIBDIR} ${OGRE_PKGCONF_LIBRARY_DIRS} $ENV{OGRE_HOME}/lib
  PATH_SUFFIXES OGRE
)

mark_as_advanced(OGRE_INCLUDE_DIR OGRE_LIBRARY OGRE_PBS_LIBRARY OGRE_UNLIT_LIBRARY OGRE_PLUGIN_DIR)

set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIR})
set(OGRE_LIBRARIES ${OGRE_LIBRARY} ${OGRE_PBS_LIBRARY} ${OGRE_UNLIT_LIBRARY})
