#3DS_FOUND if 3ds Max is found
#3DS_INCLUDE_DIR set to the SDK include folder
#


FIND_PATH(3DS_INCLUDE_DIR max.h
          PATHS
		  "$ENV{PROGRAMFILES(x86)}/Autodesk/maxsdk/include"
          "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include"
          "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include"
          "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include"
          )

MACRO (FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
          
  FIND_LIBRARY(${MYLIBRARY}
               NAMES ${MYLIBRARYNAME}
               PATHS 
			   "$ENV{PROGRAMFILES(x86)}/Autodesk/maxsdk/lib"
               "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/lib"
               "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/lib"
               "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/lib"
               )
               
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)


FIND_3DS_LIBRARY(3DS_CORE_LIBRARY core)
FIND_3DS_LIBRARY(3DS_GEOM_LIBRARY geom)
FIND_3DS_LIBRARY(3DS_GFX_LIBRARY gfx)
FIND_3DS_LIBRARY(3DS_MESH_LIBRARY mesh)
FIND_3DS_LIBRARY(3DS_MAXUTIL_LIBRARY maxutil)
FIND_3DS_LIBRARY(3DS_MAXSCRIPT_LIBRARY maxscrpt)
FIND_3DS_LIBRARY(3DS_PARAMBLK2_LIBRARY paramblk2)
FIND_3DS_LIBRARY(3DS_BMM_LIBRARY bmm)

SET(3DS_FOUND "NO")
IF(3DS_CORE_LIBRARY AND 3DS_INCLUDE_DIR)
  SET(3DS_FOUND "YES")
  
  SET(3DS_LIBRARIES
      ${3DS_CORE_LIBRARY}
      ${3DS_GEOM_LIBRARY}
      ${3DS_GFX_LIBRARY}
      ${3DS_MESH_LIBRARY}
      ${3DS_MAXUTIL_LIBRARY}
      ${3DS_MAXSCRIPT_LIBRARY}
      ${3DS_PARAMBLK2_LIBRARY}
      ${3DS_BMM_LIBRARY} )
     
ENDIF(3DS_CORE_LIBRARY AND 3DS_INCLUDE_DIR)
