check GSL version in cmake files

This commit is contained in:
Gael Guennebaud 2009-01-27 16:04:16 +00:00
parent f6aa60bcf3
commit 4b09865b8f
2 changed files with 14 additions and 0 deletions

View File

@ -113,6 +113,17 @@ ELSE(WIN32)
EXEC_PROGRAM(${GSL_CONFIG}
ARGS --libs
OUTPUT_VARIABLE GSL_CONFIG_LIBS )
# extract version
EXEC_PROGRAM(${GSL_CONFIG}
ARGS --version
OUTPUT_VARIABLE GSL_FULL_VERSION )
# split version as major/minor
STRING(REGEX MATCH "(.)\\..*" GSL_VERSION_MAJOR_ "${GSL_FULL_VERSION}")
SET(GSL_VERSION_MAJOR ${CMAKE_MATCH_1})
STRING(REGEX MATCH ".\\.(.*)" GSL_VERSION_MINOR_ "${GSL_FULL_VERSION}")
SET(GSL_VERSION_MINOR ${CMAKE_MATCH_1})
# split off the link dirs (for rpath)
# use regular expression to match wildcard equivalent "-L*<endchar>"

View File

@ -1,5 +1,8 @@
find_package(GSL)
if(GSL_FOUND AND GSL_VERSION_MINOR LESS 9)
set(GSL_FOUND "")
endif(GSL_FOUND AND GSL_VERSION_MINOR LESS 9)
if(GSL_FOUND)
add_definitions("-DHAS_GSL" ${GSL_DEFINITIONS})
include_directories(${GSL_INCLUDE_DIR})