From 68ca4c9b3224b7680373f4d096d6b43d5741f32d Mon Sep 17 00:00:00 2001 From: Dilawar Singh <dilawars@ncbs.res.in> Date: Fri, 18 Nov 2016 13:43:48 +0530 Subject: [PATCH] FindGSL also looks for GSL_VERSION now. --- moose-core/VERSION | 2 +- moose-core/cmake_modules/FindGSL.cmake | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/moose-core/VERSION b/moose-core/VERSION index 800a7627..50e47c89 100644 --- a/moose-core/VERSION +++ b/moose-core/VERSION @@ -1 +1 @@ -3.1.1-47-gf27beb9 \ No newline at end of file +3.1.1 \ No newline at end of file diff --git a/moose-core/cmake_modules/FindGSL.cmake b/moose-core/cmake_modules/FindGSL.cmake index b08eded1..013a9c81 100644 --- a/moose-core/cmake_modules/FindGSL.cmake +++ b/moose-core/cmake_modules/FindGSL.cmake @@ -4,8 +4,9 @@ # # GSL_FOUND = system has GSL lib # -# GSL_LIBRARIES = full path to the libraries -# on Unix/Linux with additional linker flags from "gsl-config --libs" +# GSL_VERSION = gsl version +# +# GSL_LIBRARIES = name of the libraries. # # GSL_INCLUDE_DIRS = where to find headers # @@ -73,7 +74,7 @@ ELSE(WIN32) /opt/lib /opt/lib64 ) - FIND_PATH(GSL_INCLUDE_DIRS NAMES gsl/gsl_blas.h gsl/gsl.h + FIND_PATH(GSL_INCLUDE_DIRS NAMES gsl/gsl_blas.h PATHS $ENV{GSL_ROOT_DIR}/include $ENV{GSL_ROOT_DIR}/include /opt/include /opt/include @@ -85,11 +86,18 @@ ELSE(WIN32) ENDIF(WIN32) +# FIND version +file(READ "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" GSL_VERSION_TEXT) +string(REGEX REPLACE ".*define[ ]+GSL_MAJOR_VERSION[ ]*([0-9]+).*" "\\1" + GSL_MAJOR_VERSION "${GSL_VERSION_TEXT}") +string(REGEX REPLACE ".*define[ ]+GSL_MINOR_VERSION[ ]*([0-9]+).*" "\\1" + GSL_MINOR_VERSION "${GSL_VERSION_TEXT}") +set(GSL_VERSION "${GSL_MAJOR_VERSION}.${GSL_MINOR_VERSION}") -IF(GSL_LIBRARIES) - IF(GSL_INCLUDE_DIRS OR GSL_CXX_FLAGS) +IF(GSL_LIBRARIES AND GSL_VERSION) + IF(GSL_INCLUDE_DIRS) SET(GSL_FOUND 1) MESSAGE(STATUS "Found GSL ${GSL_LIBRARIES}") - ENDIF(GSL_INCLUDE_DIRS OR GSL_CXX_FLAGS) -ENDIF(GSL_LIBRARIES) + ENDIF(GSL_INCLUDE_DIRS) +ENDIF() -- GitLab