gentoo/dev-util/cmake/files/cmake-3.14.0_rc1-FindLAPACK.patch

56 lines
1.8 KiB
Diff
Raw Normal View History

From 6d4d97b328f48862923bb55c1c0976b1d532dcc3 Mon Sep 17 00:00:00 2001
From: Lars Wendler <polynomial-c@gentoo.org>
Date: Sun, 10 Feb 2019 23:01:53 +0100
Subject: [PATCH] Prefer pkgconfig in FindLAPACK
---
Modules/FindLAPACK.cmake | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index d6646eaacf..ef5f324670 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -7,6 +7,10 @@ FindLAPACK
Find LAPACK library
+Version modified for Gentoo Linux.
+If a valid PkgConfig configuration is found, this overrides and cancels
+all further checks.
+
This module finds an installed fortran library that implements the
LAPACK linear-algebra interface (see http://www.netlib.org/lapack/).
@@ -181,6 +185,21 @@ endif()
endmacro()
+# first, try PkgConfig
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(PC_LAPACK lapack)
+if(PC_LAPACK_FOUND)
+ foreach(PC_LIB ${PC_LAPACK_LIBRARIES})
+ find_library(${PC_LIB}_LIBRARY NAMES ${PC_LIB} HINTS ${PC_LAPACK_LIBRARY_DIRS} )
+ if (NOT ${PC_LIB}_LIBRARY)
+ message(FATAL_ERROR "Something is wrong in your pkg-config file - lib ${PC_LIB} not found in ${PC_LAPACK_LIBRARY_DIRS}")
+ endif (NOT ${PC_LIB}_LIBRARY)
+ list(APPEND LAPACK_LIBRARIES ${${PC_LIB}_LIBRARY})
+ endforeach(PC_LIB)
+ find_package_handle_standard_args(LAPACK DEFAULT_MSG LAPACK_LIBRARIES)
+ mark_as_advanced(LAPACK_LIBRARIES)
+else(PC_LAPACK_FOUND)
+message(STATUS "No PkgConfig configuration for LAPACK found; starting more extensive search.")
set(LAPACK_LINKER_FLAGS)
set(LAPACK_LIBRARIES)
@@ -428,3 +447,5 @@ endif()
cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+
+endif(PC_LAPACK_FOUND)
--
2.20.1