 +# one level deeper in the include folder
 +IF ($ENV{ACC_CONDA_BUILD})
 +  SET (INC_DIRS
-+    $ENV{CONDA_PREFIX}/include/xraylib/
++    $ENV{PREFIX}/include/xraylib/
    )
 +ELSE ()
 +  set (INC_DIRS

-	    echo -e "Required GSL version 2.3 not found, exiting...\n"
-	    exit 72
+	if ( [[ "${CONDA_BUILD}" ]] ) ; then
+            export GSLLIBDIR=${CONDA_PREFIX}/lib
+	    export GSLINCDIR=${CONDA_PREFIX}/include
+	    echo -e "Uisng GSL library from conda in ${GSLLIBDIR}\n"
+        else
+    	    if ( [[ "${ACC_PKG}" ]] && [[ "${ACC_PKG}/${BUILD_TYPE}/lib/libgsl*19*" ]] ) ; then

 ENDIF ()
 
+# If this is a conda build we must expand the
+# library search with the PREFIX/lib
+# folder.
+IF ($ENV{ACC_CONDA_BUILD})
+  link_directories($ENV{PREFIX}/lib)
+ENDIF ()
+
 IF ($ENV{ACC_PLOT_PACKAGE} MATCHES "plplot")
