# FireBird also requires IBPP. This file searches for both.
#
# This file defines:
# - FIREBIRD_LIBRARIES
# - IBPP_ALL_IN_ONE_FILE
# - FIREBIRD_INCLUDE_DIRS
# - FIREBIRD_FOUND
# Taking into account:
# - FIREBIRD_PREFIX
# - IBPP_SRC_DIRECTORY
  
FIND_PATH(IBPP_INCLUDE ibpp.h
    ${IBPP_SRC_DIRECTORY}/core
)

FIND_FILE(IBPP_ALL_IN_ONE_FILE all_in_one.cpp
    ${IBPP_SRC_DIRECTORY}/core
)

IF(MSVC)
  SET(FBCLIENT fbclient_ms)
ELSEIF(APPLE)
  SET(FBCLIENT Firebird)
ELSEIF(UNIX)
  SET(FBCLIENT fbclient)
ENDIF(MSVC)

FIND_LIBRARY(FIREBIRD_LIBRARIES
  NAMES
    ${FBCLIENT}
  PATHS
    ${FIREBIRD_PREFIX}/lib
    /usr/lib
    /usr/lib64
    /usr/local/lib
    /opt/local/lib	
)

SET(FIREBIRD_FOUND FALSE)

IF(FIREBIRD_LIBRARIES AND IBPP_ALL_IN_ONE_FILE AND IBPP_INCLUDE)
  SET(FIREBIRD_FOUND TRUE)
  SET(FIREBIRD_INCLUDE_DIRS ${IBPP_INCLUDE})
ENDIF(FIREBIRD_LIBRARIES AND IBPP_ALL_IN_ONE_FILE AND IBPP_INCLUDE)

