From 7fbe099d763f99275e89d577a462f4195966cc0e Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Tue, 15 Apr 2025 19:59:04 +0200
Subject: [PATCH] Use CMake FindGSL module

Fixes build if /usr/include/gsl directory is polluted by ms-gsl.

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 CMakeLists.txt              |  4 +--
 src/plugins/CMakeLists.txt  |  5 ++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a4bc5239..bc84fbf0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -161,7 +161,7 @@ endif()
 if(kst_3rdparty)
   message(STATUS "3rd party libs for plugins--------------------")
   find_package(Getdata)
-  find_package(Gsl)
+  find_package(GSL)
   find_package(Netcdf)
   find_package(Matio)
   find_package(CFITSIO)
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 6c744f97..c5929d88 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -30,11 +30,10 @@ kst_add_plugin(filters window)
 kst_add_plugin(filters differentiation)
 kst_add_plugin(filters exponential)
 
-if(gsl)
-	include_directories(${GSL_INCLUDE_DIR})
+if(GSL_FOUND)
 	macro(kst_add_gsl_plugin dir name)
 		kst_add_plugin(${dir} ${name})
-		kst_link(${GSL_LIBRARIES})
+		kst_link(GSL::gsl)
 	endmacro()
 	
 	kst_add_gsl_plugin(dataobject/convolution    convolve)
-- 
2.49.0

