FIND_PATH(SOIL_INCLUDE_DIR SOIL.h /usr/include /usr/local/include/SOIL)

FIND_LIBRARY(SOIL_LIBRARY NAMES SOIL PATH /usr/lib /usr/local/lib) 

IF (SOIL_INCLUDE_DIR AND SOIL_LIBRARY)
  SET(SOIL_FOUND TRUE)
ENDIF (SOIL_INCLUDE_DIR AND SOIL_LIBRARY)

IF (SOIL_FOUND)
  IF (NOT SOIL_FIND_QUIETLY)
    MESSAGE(STATUS "Found SOIL: ${SOIL_LIBRARY}")
  ENDIF (NOT  SOIL_FIND_QUIETLY)
ELSE(SOIL_FOUND)
  IF (SOIL_FIND_REQUIRED)
    IF(NOT SOIL_INCLUDE_DIR)
      MESSAGE(FATAL_ERROR "Could not find SOIL header file!")
    ENDIF(NOT SOIL_INCLUDE_DIR)

    IF(NOT SOIL_LIBRARY)
      MESSAGE(FATAL_ERROR "Could not find LibSOIL library file!")
    ENDIF(NOT SOIL_LIBRARY)
  ENDIF (SOIL_FIND_REQUIRED)
ENDIF (SOIL_FOUND)
