IF (NOT CBLAS_ROOT)
  SET(CBLAS_ROOT $ENV{CBLAS_ROOT})
ENDIF()
IF (NOT CBLAS_ROOT)
  SET(CBLAS_ROOT $ENV{OPENBLAS_ROOT})
ENDIF()

IF (CBLAS_LIBRARIES)
  #we were given the exact list of libraries to find
  KOKKOSKERNELS_FIND_IMPORTED(CBLAS INTERFACE
    LIBRARIES ${CBLAS_LIBRARIES}
    LIBRARY_PATHS ${CBLAS_LIBRARY_DIRS}
    HEADERS cblas.h
    HEADER_PATHS ${CBLAS_INCLUDE_DIRS})
ELSE()
  #we need to find one of the valid versions from the list below
  KOKKOSKERNELS_FIND_IMPORTED(CBLAS
    LIBRARY cblas openblas blas blis
    LIBRARY_PATHS ${CBLAS_LIBRARY_DIRS}
    HEADERS cblas.h
    HEADER_PATHS ${CBLAS_INCLUDE_DIRS})
ENDIF()
