INCLUDE(FindPackageHandleStandardArgs)
# Look for the header file
if(NOT NEWMAT_INCLUDE_DIR)
	FIND_PATH(	NEWMAT_INCLUDE_DIR 
		NAMES newmat.h
		PATHS ${CMAKE_CURRENT_LIST_DIR}/include
	)
	message(${NEWMAT_INCLUDE_DIR})
endif()
MARK_AS_ADVANCED(NEWMAT_INCLUDE_DIR)


set(NEWMAT_LIBRARY 
	optimized ${CMAKE_CURRENT_LIST_DIR}/lib/Release/newmat.lib debug ${CMAKE_CURRENT_LIST_DIR}/lib/Debug/newmat.lib  
	CACHE INTERNAL "newmat library" )
MARK_AS_ADVANCED(NEWMAT_LIBRARY)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(NEWMAT REQUIRED_VARS NEWMAT_LIBRARY NEWMAT_INCLUDE_DIR)

IF(NEWMAT_FOUND)
	message("newmat found!")
	SET(NEWMAT_LIBRARIES ${NEWMAT_LIBRARY})
	SET(NEWMAT_INCLUDE_DIRS ${NEWMAT_INCLUDE_DIR})
	include_directories(${NEWMAT_INCLUDE_DIR})
	link_directories(${NEWMAT_LIBDIR})
ELSE(NEWMAT_FOUND)
	message("qfmain notfound!")
	SET(NEWMAT_LIBRARIES)
	SET(NEWMAT_LIBRARY)
	SET(NEWMAT_INCLUDE_DIR)
	SET(NEWMAT_INCLUDE_DIRS)
ENDIF(NEWMAT_FOUND)