# Find BTOGRE includes and library
#
# This module defines
#  BTOGRE_INCLUDE_DIR
#  BTOGRE_LIBRARIES, the libraries to link against to use BTOgre.
#  BTOGRE_LIB_DIR, the location of the libraries
#  BTOGRE_FOUND, If false, do not try to use BTOgre
#
# Copyright � 2007, Matt Williams
#
# Redistribution and use is allowed according to the terms of the BSD license.

IF (BTOGRE_LIBRARIES AND BTOGRE_INCLUDE_DIR)
    SET(BTOGRE_FIND_QUIETLY TRUE) # Already in cache, be silent
ENDIF (BTOGRE_LIBRARIES AND BTOGRE_INCLUDE_DIR)

IF (WIN32) #Windows
    MESSAGE(STATUS "Looking for BTOgre")
    SET(BTOGRE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dependencies/btogre/include/)
    SET(BTOGRE_LIB_DIR ${CMAKE_SOURCE_DIR}/dependencies/btogre/lib/win32/) 
    SET(BTOGRE_LIBRARIES BTOgre)
ELSE (WIN32) #Unix
    MESSAGE(STATUS "Looking for BTOgre")
    SET(BTOGRE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dependencies/btogre/include/)
    SET(BTOGRE_LIB_DIR ${CMAKE_SOURCE_DIR}/dependencies/btogre/lib/) 
    SET(BTOGRE_LIBRARIES BTOgre CACHE STRING "")
ENDIF (WIN32)

SET(BTOGRE_INCLUDE_DIR ${BTOGRE_INCLUDE_DIR} CACHE PATH "" FORCE)
SET(BTOGRE_LIB_DIR ${BTOGRE_LIB_DIR} CACHE PATH "" FORCE)
SET(BTOGRE_LIBRARIES ${BTOGRE_LIBRARIES} CACHE STRING "" FORCE)

MARK_AS_ADVANCED(BTOGRE_INCLUDE_DIR)
MARK_AS_ADVANCED(BTOGRE_LIB_DIR)
MARK_AS_ADVANCED(BTOGRE_LIBRARIES)

IF (BTOGRE_INCLUDE_DIR AND BTOGRE_LIBRARIES)
    SET(BTOGRE_FOUND TRUE)
ENDIF (BTOGRE_INCLUDE_DIR AND BTOGRE_LIBRARIES)

IF (BTOGRE_FOUND)
    IF (NOT BTOGRE_FIND_QUIETLY)
        MESSAGE(STATUS "  libraries : ${BTOGRE_LIBRARIES} from ${BTOGRE_LIB_DIR}")
        MESSAGE(STATUS "  includes  : ${BTOGRE_INCLUDE_DIR}")
    ENDIF (NOT BTOGRE_FIND_QUIETLY)
ELSE (BTOGRE_FOUND)
    IF (BTOGRE_FIND_REQUIRED)
        MESSAGE(FATAL_ERROR "Could not find BTOgre")
    ENDIF (BTOGRE_FIND_REQUIRED)
ENDIF (BTOGRE_FOUND)
