gentoo-ebuilds/dev-build/cmake/files/cmake-3.31.6-Prefer-pkgconfig-in-FindBLAS.patch
Alexey Korepanov 8471ec49af
dev-build/cmake: allow upstream behavior for FindBLAS
Gentoo patches cmake's FindBLAS changing the upstream behavior, which
sometimes breaks builds and takes time for investigation.

The corresponding bug has been open for 4.5 years: bugs.gentoo.org/736547.

This patch allows restoring the upstream behavior of FindBLAS by defining
GENTOO_REMOVE_CMAKE_BLAS_HACK. This is quite ugly, but it is easy and
less ugly than what we have right now.

[sam: new revision only for .6, not .5 (my error), not git mv, and
a new patch rather than changing the existing one in-place)]

Bug: https://bugs.gentoo.org/736547
Signed-off-by: Alexey Korepanov <kaikaikai@yandex.ru>
Closes: https://github.com/gentoo/gentoo/pull/40709
Signed-off-by: Sam James <sam@gentoo.org>
2025-03-13 12:04:46 +00:00

28 lines
861 B
Diff

diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 6d60c9d86a..b6664dfe26 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -7,6 +7,11 @@ FindBLAS
Find Basic Linear Algebra Subprograms (BLAS) library
+Version modified for Gentoo Linux.
+If a valid PkgConfig configuration is found, this overrides and cancels
+all further checks. The upstream behavior can be restored by defining
+GENTOO_REMOVE_CMAKE_BLAS_HACK
+
This module finds an installed Fortran library that implements the
`BLAS linear-algebra interface`_.
@@ -281,6 +286,11 @@ function(_add_blas_target)
endif()
endfunction()
+# first, try PkgConfig
+if(NOT DEFINED GENTOO_REMOVE_CMAKE_BLAS_HACK)
+ set(BLA_PREFER_PKGCONFIG ON)
+endif()
+
if(CMAKE_Fortran_COMPILER_LOADED)
include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
else()