summaryrefslogtreecommitdiffstats
path: root/Modules/FindBLAS.cmake
diff options
context:
space:
mode:
authorKai Pastor <dg0yt@darc.de>2024-08-07 18:11:41 (GMT)
committerKai Pastor <dg0yt@darc.de>2024-08-07 18:11:43 (GMT)
commit25b947589a165a4bba486842dd11bfb3217b146e (patch)
tree54a33fc4700e21206c745368baae24230dbfde4c /Modules/FindBLAS.cmake
parentaa6b2180bf9926e62641871908ae059c19ddb3a3 (diff)
downloadCMake-25b947589a165a4bba486842dd11bfb3217b146e.zip
CMake-25b947589a165a4bba486842dd11bfb3217b146e.tar.gz
CMake-25b947589a165a4bba486842dd11bfb3217b146e.tar.bz2
Modules: Guard calls to pkg_check_modules
Before calling pkg_check_modules, modules must check PKG_CONFIG_FOUND. When FindPkgConfig.cmake is loaded, pkg_check_modules is always defined regardless of pkg-config being present. However, the whole module might be disabled on user request with CMAKE_DISABLE_FIND_PACKAGE_PkgConfig. This must not break Find modules which just look for a hint or similar.
Diffstat (limited to 'Modules/FindBLAS.cmake')
-rw-r--r--Modules/FindBLAS.cmake14
1 files changed, 8 insertions, 6 deletions
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 2fc01d0..0bbd5a8 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -293,12 +293,14 @@ if(BLA_PREFER_PKGCONFIG)
set(BLA_PKGCONFIG_BLAS "blas")
endif()
find_package(PkgConfig QUIET)
- pkg_check_modules(PKGC_BLAS QUIET ${BLA_PKGCONFIG_BLAS})
- if(PKGC_BLAS_FOUND)
- set(BLAS_FOUND ${PKGC_BLAS_FOUND})
- set(BLAS_LIBRARIES "${PKGC_BLAS_LINK_LIBRARIES}")
- _add_blas_target()
- return()
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PKGC_BLAS QUIET ${BLA_PKGCONFIG_BLAS})
+ if(PKGC_BLAS_FOUND)
+ set(BLAS_FOUND ${PKGC_BLAS_FOUND})
+ set(BLAS_LIBRARIES "${PKGC_BLAS_LINK_LIBRARIES}")
+ _add_blas_target()
+ return()
+ endif()
endif()
endif()