FindHYPRE.cmake 847 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
find_file(HYPRE_H HYPRE.h)
find_library(HYPRE_LIB HYPRE)
if(HYPRE_H AND HYPRE_LIB)
	set(HAVE_HYPRE ON)
	find_package(MPI REQUIRED)
	#append each library in the hypre_lib directory beginning with HYPRE to the list of hypre libraries
	get_filename_component(HLIB_PATH ${HYPRE_LIB} PATH)
	file(GLOB HYPRE_OTHER ${HLIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}HYPRE*${CMAKE_SHARED_LIBRARY_SUFFIX})
	find_library(LAPACK_LIB lapack)
	set(HYPRE_LIBRARIES ${MPI_LIBRARIES} ${HYPRE_LIB} ${HYPRE_OTHER} ${LAPACK_LIB})
	message("hypre libraries: ${HYPRE_LIBRARIES}")
	get_filename_component(HYPRE_INCLUDE_DIRECTORIES ${HYPRE_H} PATH)
	list(APPEND HYPRE_INCLUDE_DIRECTORIES ${MPI_CXX_INCLUDE_PATH})
else()
	if(HAVE_HYPRE)
		message("could not find hypre:")
		message("library: ${HYPRE_LIB}")
		message("header: ${HYPRE_H}")
	endif()
	set(HAVE_HYPRE FALSE)
endif()