conan_basic_setup(NO_OUTPUT_DIRS KEEP_RPATHS)
set(CMAKE_SKIP_RPATH 0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

# set up apple frameworks
if(APPLE)
  find_library(COREFOUNDATION_LIBRARY CoreFoundation )
  find_library(COCOA_LIBRARY Cocoa)
  find_library(IOKIT NAMES IOKit)
  find_library(OpenGL_LIBRARY OpenGL)
  find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX")
  find_package(GLEW REQUIRED)
endif(APPLE)

set(LUAJIT_INCLUDE_DIR ${CONAN_INCLUDE_DIRS_LUAJIT})
set(MSGPACK_INCLUDE_DIR ${CONAN_INCLUDE_DIRS_MSGPACK})

# core libraries
set(LUAJIT_LIBRARIES ${CONAN_LIBS_LUAJIT-ROCKS})
set(MSGPACK_LIBRARIES ${CONAN_LIBS_MSGPACK})

# optional stuff

# setting up ogre libraries and all it's dependencies
if(CONAN_LIBS_OGRE)
  set(OGRE_LIBRARIES
    ${CONAN_LIBS_OGRE}
    ${CONAN_LIBS_BOOST}
    ${CONAN_LIBS_FREETYPE}
    ${CONAN_LIBS_ZZIPLIB}
    ${CONAN_LIBS_ZLIB}
    ${CONAN_LIBS_LIBPNG}
    ${CONAN_LIBS_FREEIMAGE}
    ${CONAN_LIBS_BZIP2}
  )
  set(OGRE_FOUND true)
endif(CONAN_LIBS_OGRE)

# adding plugins includes
set(OGRE_INCLUDE_DIRS
  ${CONAN_INCLUDE_DIRS_OGRE}/RenderSystems/GL
  ${CONAN_INCLUDE_DIRS_OGRE}/Plugins/OctreeSceneManager
  ${CONAN_INCLUDE_DIRS_OGRE}/Plugins/BSPSceneManager
  ${CONAN_INCLUDE_DIRS_OGRE}/Plugins/PCZSceneManager
  ${CONAN_INCLUDE_DIRS_OGRE}/Plugins/ParticleFX
  ${CONAN_INCLUDE_DIRS_OGRE}/Overlay
  ${GLEW_INCLUDE_DIRS}
  ${OGRE_INCLUDE_DIRS}
)

if("${OGRE_VERSION_MAJOR}" STREQUAL "2")
set(OGRE_INCLUDE_DIRS
  ${OGRE_INCLUDE_DIRS}
  ${CONAN_INCLUDE_DIRS_OGRE}/RenderSystems/GL3Plus
  ${CONAN_INCLUDE_DIRS_OGRE}/Hlms/Pbs
  ${CONAN_INCLUDE_DIRS_OGRE}/Hlms/Unlit
  ${CONAN_INCLUDE_DIRS_OGRE}/Hlms/Common
)
endif("${OGRE_VERSION_MAJOR}" STREQUAL "2")

# for static build
if(CONAN_USER_OGRE_STATIC)
  add_definitions("-D OGRE_STATIC")
endif(CONAN_USER_OGRE_STATIC)

# GTEST
if(CONAN_LIBS_GTEST)
  set(GTEST_LIBRARIES ${CONAN_LIBS_GTEST})
  set(GTEST_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_GTEST})
  set(GTEST_FOUND true)
endif(CONAN_LIBS_GTEST)

# OIS
if(CONAN_LIBS_OIS)
  set(OIS_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_OIS}/OIS)
  set(OIS_LIBRARIES ${CONAN_LIBS_OIS})
  set(OIS_FOUND true)
endif(CONAN_LIBS_OIS)

# LibRocket
if(CONAN_LIBS_LIBROCKET)
  set(LIBROCKET_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LIBROCKET})
  set(LIBROCKET_LIBRARIES ${CONAN_LIBS_LIBROCKET})
  set(LIBROCKET_FOUND true)
endif(CONAN_LIBS_LIBROCKET)

# SDL2
if(CONAN_LIBS_SDL2)
  set(SDL_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_SDL2})
  set(SDL_LIBRARIES ${CONAN_LIBS_SDL2})
  set(SDL_FOUND true)
endif(CONAN_LIBS_SDL2)

# Recast
if(CONAN_LIBS_RECAST)
  set(RECAST_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_RECAST})
  set(RECAST_LIBRARIES ${CONAN_LIBS_RECAST})
  set(RECAST_FOUND true)
endif(CONAN_LIBS_RECAST)

set(INJA_INCLUDE_DIRS "${CONAN_INCLUDE_DIRS_INJA} ${CONAN_INCLUDE_DIRS_JSONFORMODERNCPP}")
set(INJA_LIBRARIES "")

set(POCO_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_POCO})
set(POCO_LIBRARIES ${CONAN_LIBS_POCO})
