# Find CEGUI includes and library
#
# This module defines
#  CEGUI_INCLUDE_DIR
#  CEGUI_LIBRARIES, the libraries to link against to use OGRE.
#  CEGUI_LIB_DIR, the location of the libraries
#  CEGUI_FOUND, If false, do not try to use OGRE
#
# Copyright � 2007, Matt Williams
#
# Redistribution and use is allowed according to the terms of the BSD license.

IF (CEGUI_LIBRARIES AND CEGUI_INCLUDE_DIR)
    SET(CEGUI_FIND_QUIETLY TRUE) # Already in cache, be silent
ENDIF (CEGUI_LIBRARIES AND CEGUI_INCLUDE_DIR)

IF (WIN32) #Windows
    MESSAGE(STATUS "Looking for CEGUI")
    SET(CEGUI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dependencies/cegui/include/)
    SET(CEGUI_LIB_DIR ${CMAKE_SOURCE_DIR}/dependencies/cegui/lib/) 
    SET(CEGUI_LIBRARIES debug CEGUI optimized CEGUI)
ELSE (WIN32) #Unix
    MESSAGE(STATUS "Looking for CEGUI")
    SET(CEGUI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dependencies/cegui/include/)
    SET(CEGUI_LIB_DIR ${CMAKE_SOURCE_DIR}/dependencies/cegui/lib/) 
    SET(CEGUI_LIBRARIES CEGUIBase CEGUIExpatParser CEGUIFalagardWRBase CEGUIFreeImageImageCodec CEGUITGAImageCodec CEGUITinyXMLParser CEGUIOgreRenderer CACHE STRING "")
ENDIF (WIN32)

SET(CEGUI_INCLUDE_DIR ${CEGUI_INCLUDE_DIR} CACHE PATH "" FORCE)
SET(CEGUI_LIB_DIR ${CEGUI_LIB_DIR} CACHE PATH "" FORCE)
SET(CEGUI_LIBRARIES ${CEGUI_LIBRARIES} CACHE STRING "" FORCE)

MARK_AS_ADVANCED(CEGUI_INCLUDE_DIR)
MARK_AS_ADVANCED(CEGUI_LIB_DIR)
MARK_AS_ADVANCED(CEGUI_LIBRARIES)

IF (CEGUI_INCLUDE_DIR AND CEGUI_LIBRARIES)
    SET(CEGUI_FOUND TRUE)
ENDIF (CEGUI_INCLUDE_DIR AND CEGUI_LIBRARIES)

IF (CEGUI_FOUND)
    IF (NOT CEGUI_FIND_QUIETLY)
        MESSAGE(STATUS "  libraries : ${CEGUI_LIBRARIES} from ${CEGUI_LIB_DIR}")
        MESSAGE(STATUS "  includes  : ${CEGUI_INCLUDE_DIR}")
    ENDIF (NOT CEGUI_FIND_QUIETLY)
ELSE (CEGUI_FOUND)
    IF (CEGUI_FIND_REQUIRED)
        MESSAGE(FATAL_ERROR "Could not find CEGUI")
    ENDIF (CEGUI_FIND_REQUIRED)
ENDIF (CEGUI_FOUND)
