2 # This file is part of the GROMACS molecular simulation package.
4 # Copyright (c) 2009-2011, by the VOTCA Development Team (http://www.votca.org)
5 # Copyright (c) 2012,2013 by the GROMACS development team, led by
6 # David van der Spoel, Berk Hess, Erik Lindahl, and including many
7 # others, as listed in the AUTHORS file in the top-level source
8 # directory and at http://www.gromacs.org.
10 # GROMACS is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public License
12 # as published by the Free Software Foundation; either version 2.1
13 # of the License, or (at your option) any later version.
15 # GROMACS is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with GROMACS; if not, see
22 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 # If you want to redistribute modifications to GROMACS, please
26 # consider that scientific software is very special. Version
27 # control is crucial - bugs must be traceable. We will be happy to
28 # consider code for inclusion in the official distribution, but
29 # derived work must not be called official GROMACS. Details are found
30 # in the README & COPYING files - if they are missing, get the
31 # official version at http://www.gromacs.org.
33 # To help us fund GROMACS development, we humbly ask that you cite
34 # the research papers on the package. Check out http://www.gromacs.org.
37 # Find the native GSL headers and libraries.
39 # GSL_INCLUDE_DIRS - where to find gsl/gsl_linalg.h, etc.
40 # GSL_LIBRARIES - List of libraries when using gsl.
41 # GSL_FOUND - True if gsl found.
44 find_package(PkgConfig)
46 pkg_check_modules(PC_GSL gsl)
47 find_path(GSL_INCLUDE_DIR gsl/gsl_linalg.h HINTS ${PC_GSL_INCLUDE_DIRS})
48 find_library(GSL_LIBRARY NAMES gsl HINTS ${PC_GSL_LIBRARY_DIRS} )
49 find_library(GSLCBLAS_LIBRARY NAMES gslcblas cblas HINTS ${PC_GSL_LIBRARY_DIRS} )
51 include(FindPackageHandleStandardArgs)
52 # handle the QUIETLY and REQUIRED arguments and set GSL_FOUND to TRUE
53 # if all listed variables are TRUE
54 find_package_handle_standard_args(GSL DEFAULT_MSG GSL_LIBRARY GSL_INCLUDE_DIR GSLCBLAS_LIBRARY)
56 set(GSL_LIBRARIES "${GSL_LIBRARY};${GSLCBLAS_LIBRARY}")
57 set(GSL_INCLUDE_DIRS ${GSL_INCLUDE_DIR} )
60 include(CheckLibraryExists)
61 check_library_exists("${GSLCBLAS_LIBRARY};${MATH_LIBRARIES}" cblas_dsyrk "" FOUND_DSYRK)
63 message(FATAL_ERROR "Could not find cblas_dsyrk in ${GSLCBLAS_LIBRARY}, take a look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what was going wrong. If you are using a static lib (.a) make sure you have specified all dependencies of libcblas in GSLCBLAS_LIBRARY by hand (e.g. -DGSLCBLAS_LIBRARY='/path/to/libcblas.so;/path/to/libm.so')! If your gsl was build against an different version of cblas, specify it in GSLCBLAS_LIBRARY")
64 endif(NOT FOUND_DSYRK)
65 #adding MATH_LIBRARIES here to allow static libs, this does not harm us as we are anyway using it
66 check_library_exists("${GSL_LIBRARIES};${MATH_LIBRARIES}" gsl_linalg_QR_decomp "" FOUND_QR_DECOMP)
67 if(NOT FOUND_QR_DECOMP)
68 message(FATAL_ERROR "Could not find gsl_linalg_QR_decompx in ${GSL_LIBRARY}, take a look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what was going wrong. If you are using a static lib (.a) make sure you have specified all dependencies of libgsl in GSL_LIBRARY by hand (e.g. -DGSL_LIBRARY='/path/to/libgsl.so;/path/to/libm.so') !")
69 endif(NOT FOUND_QR_DECOMP)
72 mark_as_advanced(GSL_INCLUDE_DIR GSL_LIBRARY)