--- cmake-2.8.6.orig/Modules/FindLAPACK.cmake 2011-10-09 23:38:48.956933106 +0800 +++ cmake-2.8.6/Modules/FindLAPACK.cmake 2011-10-09 23:39:52.002144646 +0800 @@ -1,3 +1,9 @@ +# +# Version modified for Gentoo Linux +# If a valid PkgConfig configuration is found, this overrides and cancels +# all further checks. +# + # - Find LAPACK library # This module finds an installed fortran library that implements the LAPACK # linear-algebra interface (see http://www.netlib.org/lapack/). @@ -36,6 +42,14 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +# +# first, try PkgConfig +# +find_package(PkgConfig REQUIRED) +pkg_check_modules(LAPACK lapack) +if(NOT LAPACK_FOUND) +message(STATUS "No PkgConfig configuration for LAPACK found; starting more extensive search.") + set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) @@ -304,4 +318,6 @@ endif(NOT LAPACK_FIND_QUIETLY) endif(BLA_F95) set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) + +endif(NOT LAPACK_FOUND)