FindBLAS: do not write an imported target name into BLAS_LIBRARIES

Since commit v3.11.0-rc1~177^2 (FindBLAS: optionally query pkg-config
for a library, 2017-12-15) the `BLAS_LIBRARIES` result variable may
incorrectly contain the name of an imported target.  Instead store the
list of libraries in the variable.  Unfortunately pkg_check_modules does
not provide a way to get this so we need to use a (temporary) hack of
reading `INTERFACE_LINK_LIBRARIES` from the interface library target.

Fixes: #17934
This commit is contained in:
Rolf Eike Beer
2018-04-24 19:23:26 +02:00
committed by Brad King
parent 946846aaf5
commit 7d756f37cc

View File

@@ -90,7 +90,11 @@ 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)
# FIXME: We should not interpret the INTERFACE_LINK_LIBRARIES property
# because it could have generator expressions and such. This is a
# workaround for pkg_check_modules not providing a first-class way to
# get the list of libraries.
get_property(BLAS_LIBRARIES TARGET PkgConfig::PKGC_BLAS PROPERTY INTERFACE_LINK_LIBRARIES)
find_package_handle_standard_args(BLAS
REQUIRED_VARS BLAS_LIBRARIES
VERSION_VAR PKGC_BLAS_VERSION)