FIND_PATH(TBB_INCLUDE_DIR tbb/tbb.h
  /usr/local/include
  /usr/include
  /opt/local/include
)

FIND_LIBRARY(TBB_CORE_LIBRARY NAMES tbb)
FIND_LIBRARY(TBB_MALLOC_LIBRARY NAMES tbbmalloc)

# handle the QUIETLY and REQUIRED arguments and set TBB_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB  DEFAULT_MSG  TBB_CORE_LIBRARY  TBB_INCLUDE_DIR)

IF(TBB_FOUND)
  SET( TBB_LIBRARIES ${TBB_CORE_LIBRARY} ${TBB_MALLOC_LIBRARY} )
  IF(NOT TBB_FIND_QUIETLY)
    MESSAGE(STATUS "Found TBB (TBB_LIBRARIES = ${TBB_LIBRARIES})")
    MESSAGE(STATUS "Found TBB (TBB_INCLUDE_DIR = ${TBB_INCLUDE_DIR})")
  ENDIF(NOT TBB_FIND_QUIETLY)
ELSE(TBB_FOUND)
  IF(TBB_FIND_REQUIRED)
    MESSAGE(FATAL_ERROR "Could not find TBB")
  ENDIF(TBB_FIND_REQUIRED)
ENDIF(TBB_FOUND)

MARK_AS_ADVANCED(TBB_INCLUDE_DIR TBB_LIBRARY)
