Commit a9c42e3e authored by Rolf Eike Beer's avatar Rolf Eike Beer
Browse files

FindBLAS: optionally query pkg-config for a library

This is more or less what Gentoo implements for years, but in a more
sophisticated version that uses the target mode now offered by
pkg_check_modules().
parent c095e2ad
......@@ -27,10 +27,17 @@
# to link against to use BLAS95 interface
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
# is found
#
# The following variables can be used to control this module:
#
# ::
#
# BLA_STATIC if set on this determines what kind of linkage we do (static)
# BLA_VENDOR if set checks only the specified vendor, if not set checks
# all the possibilities
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
# BLA_PREFER_PKGCONFIG if set pkg-config will be used to search for a BLAS
# library first and if one is found that is preferred
#
# List of vendors (BLA_VENDOR) valid in this module:
#
......@@ -79,6 +86,18 @@ if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_C
endif()
endif()
if(BLA_PREFER_PKGCONFIG)
find_package(PkgConfig)
pkg_check_modules(PKGC_BLAS IMPORTED_TARGET blas)
if(PKGC_BLAS_FOUND)
set(BLAS_LIBRARIES PkgConfig::PKGC_BLAS)
find_package_handle_standard_args(BLAS
REQUIRED_VARS BLAS_LIBRARIES
VERSION_VAR PKGC_BLAS_VERSION)
return()
endif()
endif()
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
# This macro checks for the existence of the combination of fortran libraries
# given by _list. If the combination is found, this macro checks (using the
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment