FindNativeBlasLapack.cmake 1.21 KB
Newer Older
Blake Nelson's avatar
Blake Nelson committed
1

's avatar
committed
2 3 4 5 6 7 8 9 10 11 12
SET(TEST_ENV $ENV{LAPACK_DIR})
IF(NOT DEFINED LAPACK_DIR AND DEFINED TEST_ENV)
	SET(LAPACK_DIR $ENV{LAPACK_DIR})
ENDIF()

SET( NATIVE_BLAS_LAPACK_SEARCH_PATHS /usr/lib
									 /usr/lib64
									 /usr/local/lib
									 /usr/local/lib64
									 ${LAPACK_DIR}/lib64
									 ${LAPACK_DIR}/lib)
Blake Nelson's avatar
Blake Nelson committed
13 14 15

FIND_LIBRARY(NATIVE_BLAS NAMES blas PATHS ${NATIVE_BLAS_LAPACK_SEARCH_PATHS})
FIND_LIBRARY(NATIVE_LAPACK NAMES lapack PATHS ${NATIVE_BLAS_LAPACK_SEARCH_PATHS})
Kilian Lackhove's avatar
Kilian Lackhove committed
16 17
GET_FILENAME_COMPONENT(NATIVE_BLAS_LIB_DIR ${NATIVE_BLAS} PATH)
GET_FILENAME_COMPONENT(NATIVE_LAPACK_LIB_DIR ${NATIVE_LAPACK} PATH)
Blake Nelson's avatar
Blake Nelson committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33


IF (NATIVE_BLAS AND NATIVE_LAPACK)
  SET(NATIVE_BLAS_LAPACK_FOUND ON)
ENDIF (NATIVE_BLAS AND NATIVE_LAPACK)

IF (NATIVE_BLAS_LAPACK_FOUND)
  IF (NOT NATIVE_BLAS_LAPACK_FIND_QUIETLY)
     MESSAGE(STATUS "Found Native Blas and Lapack")
  ENDIF (NOT NATIVE_BLAS_LAPACK_FIND_QUIETLY)
ELSE(NATIVE_BLAS_LAPACK_FOUND)
  IF (NATIVE_BLAS_LAPACK_FIND_REQUIRED)
     MESSAGE(FATAL_ERROR "Could not find Native blas and lapack libraries.")
  ENDIF (NATIVE_BLAS_LAPACK_FIND_REQUIRED)
ENDIF (NATIVE_BLAS_LAPACK_FOUND)

34 35
MARK_AS_ADVANCED(NATIVE_BLAS)
MARK_AS_ADVANCED(NATIVE_LAPACK)
Kilian Lackhove's avatar
Kilian Lackhove committed
36 37
MARK_AS_ADVANCED(NATIVE_BLAS_LIB_DIR)
MARK_AS_ADVANCED(NATIVE_LAPACK_LIB_DIR)
Blake Nelson's avatar
Blake Nelson committed
38