Mini FindHydrax.cmake script

Nodrev

21-02-2011 22:24:42

Hi,

For those who like me find cmake fantastic, here a small script file to use Hydrax on your cmake projects.
#-------------------------------------------------------------------
# This file is part of the CMake build system for USUL
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------

# Locate Xavy's Hydrax Ogre plugin
# This module defines
# Hydrax_FOUND - True when the Hydrax include directory is found.
# Hydrax_INCLUDE_DIRS - the Hydrax include files.
# Hydrax_LIBRARIES - the Hydrax library files.
#
# HYDRAX_ROOT is an environment variable that would be set for windows users.
#
# Created by Jean-François VERDON. This was influenced by the FindBoost.cmake module.

SET(Hydrax_INCLUDE_PATH_DESCRIPTION "the base directory containing the Hydrax include files. E.g /usr/Hydrax/include or C:/MyLibs/Hydrax")
SET(Hydrax_DIR_MESSAGE "Set the Hydrax_INCLUDE_DIR cmake cache entry to ${Hydrax_INCLUDE_PATH_DESCRIPTION}")
SET(Hydrax_DIR_SEARCH $ENV{HYDRAX_ROOT})

#
# Look for include files.
#
FIND_PATH(Hydrax_DIR NAMES src/Hydrax PATHS ${Hydrax_DIR_SEARCH} DOC "${Hydrax_INCLUDE_PATH_DESCRIPTION}")
FIND_PATH(Hydrax_INCLUDE_DIR NAMES Hydrax.h PATH_SUFFIXES src/Hydrax PATHS ${Hydrax_DIR} DOC "The directory should contain Hydrax includes")
SET(Hydrax_INCLUDE_DIRS ${Hydrax_INCLUDE_DIR})

#
# Look for library files.
#
SET(Hydrax_LIB_DIR_SEARCH
${Hydrax_DIR}/bin/release
${Hydrax_DIR}/bin/debug
)

FIND_LIBRARY(Hydrax_LIBRARY NAMES Hydrax PATHS ${Hydrax_LIB_DIR_SEARCH})
SET(Hydrax_LIBRARIES ${Hydrax_LIBRARY})

# Set CMake return value
set (Hydrax_FOUND "FALSE")
if (Hydrax_INCLUDE_DIRS AND Hydrax_LIBRARIES)
set (Hydrax_FOUND "TRUE")
endif (Hydrax_INCLUDE_DIRS AND Hydrax_LIBRARIES)


Set the env variable "HYDRAX_ROOT" before using.
Not tested under linux.