FILE(
	GLOB
	CGAL_COMPILER_INCLUDE_PATHS
	$ENV{CGALROOT}/include/CGAL/config/*
	$ENV{HOME}/include/CGAL/config/*
	/usr/local/include/CGAL/config/*
	/usr/include/CGAL/config/*
	$ENV{ProgramW6432}/CGAL*/include/CGAL/config/*
	$ENV{ProgramFiles}/CGAL*/include/CGAL/config/*
)
FILE(
	GLOB
	CGAL_INCLUDE_PATHS
	$ENV{CGALROOT}/include
	$ENV{HOME}/include
	/usr/local/include
	/usr/include
	$ENV{ProgramW6432}/CGAL*/include
	$ENV{ProgramFiles}/CGAL*/include
)
FILE(
	GLOB
	CGAL_LIBRARY_PATHS
	$ENV{CGALROOT}/lib
	$ENV{HOME}/lib
	/usr/local/lib
	/usr/lib
	$ENV{ProgramW6432}/CGAL*/lib
	$ENV{ProgramFiles}/CGAL*/lib
)

FIND_PATH(
	CGAL_COMPILER_INCLUDE_DIR
	NAMES
	CGAL/compiler_config.h
	HINTS
	${CGAL_COMPILER_INCLUDE_PATHS}
	${CGAL_INCLUDE_PATHS}
)

FIND_PATH(
	CGAL_INCLUDE_DIR
	NAMES
	CGAL/CORE/CORE.h
	HINTS
	${CGAL_INCLUDE_PATHS}
)

FIND_LIBRARY(
	CGAL_LIBRARY_DEBUG
	NAMES
	CGALd cgal-vc100-mt-gd cgal-vc90-mt-gd cgal-vc80-mt-gd cgal-vc71-mt-gd
	HINTS
	${CGAL_LIBRARY_PATHS}
)

FIND_LIBRARY(
	CGAL_LIBRARY_RELEASE
	NAMES
	CGAL cgal-vc100-mt cgal-vc90-mt cgal-vc80-mt cgal-vc71-mt
	HINTS
	${CGAL_LIBRARY_PATHS}
)

IF (CGAL_LIBRARY_DEBUG AND NOT CGAL_LIBRARY_RELEASE)
	SET(CGAL_LIBRARIES ${CGAL_LIBRARY_DEBUG})
ENDIF (CGAL_LIBRARY_DEBUG AND NOT CGAL_LIBRARY_RELEASE)

IF (CGAL_LIBRARY_RELEASE AND NOT CGAL_LIBRARY_DEBUG)
	SET(CGAL_LIBRARIES ${CGAL_LIBRARY_RELEASE})
ENDIF (CGAL_LIBRARY_RELEASE AND NOT CGAL_LIBRARY_DEBUG)

IF (CGAL_LIBRARY_DEBUG AND CGAL_LIBRARY_RELEASE)
	SET(CGAL_LIBRARIES debug ${CGAL_LIBRARY_DEBUG} optimized ${CGAL_LIBRARY_RELEASE})
ENDIF (CGAL_LIBRARY_DEBUG AND CGAL_LIBRARY_RELEASE)

SET(CGAL_INCLUDE_DIRS ${CGAL_INCLUDE_DIR} ${CGAL_COMPILER_INCLUDE_DIR})

FIND_PACKAGE_HANDLE_STANDARD_ARGS(
	CGAL
	DEFAULT_MSG
	CGAL_INCLUDE_DIRS
	CGAL_LIBRARIES
)

MARK_AS_ADVANCED(
	CGAL_COMPILER_INCLUDE_DIR
	CGAL_INCLUDE_DIR
	CGAL_INCLUDE_DIRS
	CGAL_LIBRARIES
	CGAL_LIBRARY_DEBUG
	CGAL_LIBRARY_RELEASE
) 
