From b67ff61c3a128925947cda45fd924727fac3b9b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D9=85=D9=87=D8=AF=D9=8A=20=D8=B4=D9=8A=D9=86=D9=88=D9=86?= =?UTF-8?q?=20=28Mehdi=20Chinoune=29?= Date: Fri, 17 Dec 2021 03:27:46 -0500 Subject: FindGSL: Improve version extraction regex Backport commit 58f2708b90 (FindGSL: Improve version extraction regex, 2021-12-17) to the CMake 3.22 branch. Fixes: #23017 --- Modules/FindGSL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake index 3d4e7f9..485735a 100644 --- a/Modules/FindGSL.cmake +++ b/Modules/FindGSL.cmake @@ -139,7 +139,7 @@ if( NOT GSL_VERSION ) # 2. If gsl-config is not available, try looking in gsl/gsl_version.h if( NOT GSL_VERSION AND EXISTS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" ) file( STRINGS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" gsl_version_h_contents REGEX "define GSL_VERSION" ) - string( REGEX REPLACE ".*([0-9]\\.[0-9][0-9]?).*" "\\1" GSL_VERSION ${gsl_version_h_contents} ) + string( REGEX REPLACE ".*define[ ]+GSL_VERSION[ ]+\"([^\"]*)\".*" "\\1" GSL_VERSION ${gsl_version_h_contents} ) endif() # might also try scraping the directory name for a regex match "gsl-X.X" -- cgit v0.12