File: FindCBLAS.cmake

package info (click to toggle)
flint 3.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 68,996 kB
  • sloc: ansic: 915,350; asm: 14,605; python: 5,340; sh: 4,512; lisp: 2,621; makefile: 787; cpp: 341
file content (45 lines) | stat: -rw-r--r-- 1,387 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Try to find BLAS, including cblas.h
#
# Once done this will define
#  CBLAS_FOUND        - system has a BLAS library
#  CBLAS_INCLUDE_DIR  - the header directory containing cblas.h
#  CBLAS_LIBRARY      - the CBLAS library

# Copyright (c) 2020, Mahrud Sayrafi, <mahrud@umn.edu>
# Redistribution and use is allowed according to the terms of the BSD license.

find_path(CBLAS_INCLUDE_DIR NAMES cblas.h
  HINTS CBLAS_ROOT ENV CBLAS_ROOT
  PATHS ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX}/include
  PATH_SUFFIXES openblas cblas blis flexiblas
  )

find_library(CBLAS_LIBRARY NAMES accelerate openblas cblas blas blis flexiblas
  HINTS CBLAS_ROOT ENV CBLAS_ROOT
  PATHS ${LIB_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX}/lib
  PATH_SUFFIXES openblas cblas blis flexiblas
  )

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args( CBLAS
  FOUND_VAR CBLAS_FOUND
  REQUIRED_VARS
    CBLAS_LIBRARY
    CBLAS_INCLUDE_DIR
  )

if(CBLAS_FOUND)
  set(CBLAS_INCLUDE_DIRS ${CBLAS_INCLUDE_DIR})
  set(CBLAS_LIBRARIES ${CBLAS_LIBRARY})
  if(NOT TARGET CBLAS::CBLAS)
    add_library(CBLAS::CBLAS UNKNOWN IMPORTED)
    set_target_properties( CBLAS::CBLAS
      PROPERTIES
        IMPORTED_LOCATION "${CBLAS_LIBRARY}"
        INTERFACE_INCLUDE_DIRECTORIES "${CBLAS_INCLUDE_DIR}" 
      )
  endif()
  mark_as_advanced(CBLAS_ROOT)
endif()

mark_as_advanced(CBLAS_LIBRARY CBLAS_INCLUDE_DIR)