Warning, /graphics/krita/cmake/modules/FindGSL.cmake is written in an unsupported language. File is not indexed.

0001 # - Find GSL
0002 # Find the GNU Scientific Library (GSL) includes and library
0003 #
0004 # This module defines
0005 #  GSL_FOUND
0006 #  GSL_LIBRARIES
0007 #  GSL_CBLAS_LIBRARIES
0008 #  GSL_INCLUDE_DIR
0009 #  GSL_VERSION
0010 #
0011 # SPDX-License-Identifier: BSD-3-Clause
0012 #
0013 
0014 include(UsePkgConfig)
0015 
0016 if (GSL_INCLUDE_DIR AND GSL_LIBRARIES AND GSL_CBLAS_LIBRARIES AND GSL_VERSION)
0017 
0018         # Already in cache
0019         SET(GSL_FOUND TRUE)
0020 
0021 else ()
0022 
0023         FIND_LIBRARY (GSL_LIBRARIES gsl)
0024 
0025         FIND_LIBRARY (GSL_CBLAS_LIBRARIES gslcblas)
0026 
0027         FIND_PATH (GSL_INCLUDE_DIR gsl_multimin.h
0028                 /usr/include
0029                 /usr/local/include
0030         ${CMAKE_INCLUDE_PATH}
0031                 PATH_SUFFIXES gsl
0032         )
0033 
0034         if (NOT WIN32)
0035                 FIND_PROGRAM (GSL_CONFIG gsl-config)
0036 
0037                 IF (GSL_CONFIG)
0038                         EXEC_PROGRAM (${GSL_CONFIG} ARGS "--version" OUTPUT_VARIABLE gsl_version)
0039                 #       EXEC_PROGRAM (${GSL_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE gsl_include_dir)
0040                 #       EXEC_PROGRAM (${GSL_CONFIG} ARGS "--libs" OUTPUT_VARIABLE gsl_libraries)
0041 
0042                 #       STRING (REGEX REPLACE "-I([^ ]*)" "\\1" GSL_INCLUDE_DIR "${gsl_include_dir}")
0043                 #       STRING (REGEX REPLACE "-L([^ ]*)" "\\1" GSL_LIBRARIES "${gsl_libraries}")
0044                         SET (GSL_VERSION ${gsl_version} CACHE STRING "GNU Scientific Library Version")
0045                         # TODO check version! 1.6 suffices?
0046                 ENDIF (GSL_CONFIG)
0047         else ()
0048                 file(STRINGS ${GSL_INCLUDE_DIR}/gsl_version.h gsl_version REGEX "^#define GSL_VERSION \"(.+)\"$")
0049                 string(REGEX REPLACE "^#define GSL_VERSION \"(.+)\"$" "\\1" gsl_version "${gsl_version}")
0050                 SET (GSL_VERSION ${gsl_version} CACHE STRING "GNU Scientific Library Version")
0051         endif ()
0052 
0053         IF (NOT GSL_INCLUDE_DIR OR NOT GSL_VERSION)
0054                 # Try pkg-config instead, but only for the
0055                 # include directory, since we really need
0056                 # the *LIBRARIES to point to the actual .so's.
0057                 PKGCONFIG(gsl GSL_INCLUDE_DIR dummy dummy dummy)
0058         ENDIF (NOT GSL_INCLUDE_DIR OR NOT GSL_VERSION)
0059         #
0060         # everything necessary found?
0061         #
0062         IF (GSL_LIBRARIES AND GSL_CBLAS_LIBRARIES AND GSL_INCLUDE_DIR)
0063                 SET (GSL_FOUND TRUE)
0064         ELSE (GSL_LIBRARIES AND GSL_CBLAS_LIBRARIES AND GSL_INCLUDE_DIR)
0065                 SET (GSL_FOUND FALSE)
0066         ENDIF (GSL_LIBRARIES AND GSL_CBLAS_LIBRARIES AND GSL_INCLUDE_DIR)
0067 
0068 endif ()
0069 
0070 
0071 #
0072 # output status
0073 #
0074 if (GSL_FOUND)
0075      if (NOT GSL_FIND_QUIETLY)
0076         MESSAGE (STATUS "Found GNU Scientific Library: ${GSL_VERSION} (${GSL_INCLUDE_DIR} ${GSL_LIBRARIES};${GSL_CBLAS_LIBRARIES})")
0077      endif()
0078 else ()
0079      if (GSL_FIND_REQUIRED)
0080         MESSAGE (FATAL_ERROR "Required package gsl NOT found")
0081      endif ()
0082 endif ()
0083