--- bindings/ocaml/CMakeLists.txt.orig	2019-06-01 23:24:33 UTC
+++ bindings/ocaml/CMakeLists.txt
@@ -1,11 +1,11 @@
 # -*- mode: cmake -*-
 # bindings/ocaml/CMakeLists.txt
 #
+# Copyright (C) 2008-2011 Andrew Ross
+# Copyright (C) 2008-2021 Alan W. Irwin
+# Copyright (C) 2009-2013 Hezekiah M. Carty
+# Patch borrowed from https://sourceforge.net/p/plplot/plplot/ci/52479b8830ee02900b41fe3ec947aed6b1841a48/
 #
-# Copyright (C) 2008 Andrew Ross
-# Copyright (C) 2009 Hezekiah M. Carty
-# Copyright (C) 2009-2018 Alan W. Irwin
-#
 # This file is part of PLplot.
 #
 # PLplot is free software; you can redistribute it and/or modify
@@ -142,9 +142,9 @@ if(ENABLE_ocaml)
       list(APPEND ocaml_LIBRARIES_FLAGS ${LIBRARY_LIST})
     endforeach(library in LISTS library_LIST)
 
-    # Get rid of internal symbolic targets and symbolic Qt5 targets from the list
+    # Get rid of internal, Threads, Qt5, and Qhull symbolic targets from the list.
     #message(STATUS "DEBUG: (original) ocaml_LIBRARIES_FLAGS = ${ocaml_LIBRARIES_FLAGS}")
-    list(FILTER ocaml_LIBRARIES_FLAGS EXCLUDE REGEX "^PLPLOT::csirocsa$|^PLPLOT::csironn$|^PLPLOT::nistcd$|^PLPLOT::qsastime$|^Qt5::")
+    list(FILTER ocaml_LIBRARIES_FLAGS EXCLUDE REGEX "^PLPLOT::csirocsa$|^PLPLOT::csironn$|^PLPLOT::nistcd$|^PLPLOT::qsastime$|^Threads::Threads$|^Qt5::|Qhull::")
     #message(STATUS "DEBUG: (filtered) ocaml_LIBRARIES_FLAGS = ${ocaml_LIBRARIES_FLAGS}")
 
     # Add C++ libraries in case there is at least one C++ device
@@ -159,6 +159,17 @@ if(ENABLE_ocaml)
       list(APPEND ocaml_LIBRARIES_FLAGS ${pc_qt_LIBRARIES_LIST})
       #message(STATUS "DEBUG: (Qt5 added) ocaml_LIBRARIES_FLAGS = ${ocaml_LIBRARIES_FLAGS}")
     endif(PLPLOT_USE_QT5)
+
+    # Add back actual qhull_r library to replace the symbolic
+    # form of Qhull library that was removed above.
+    if(PL_HAVE_QHULL)
+      list(APPEND ocaml_LIBRARIES_FLAGS )
+      if(QHULL_RPATH)
+	list(APPEND ocaml_LIBRARIES_FLAGS -L${QHULL_RPATH} -lqhull_r)
+      else(QHULL_RPATH)
+	list(APPEND ocaml_LIBRARIES_FLAGS -lqhull_r)
+      endif(QHULL_RPATH)
+    endif(PL_HAVE_QHULL)
 
     # There is a long-standing bug for cmake where the regexp "^[^-]"
     # acts the same as "[^-]", i.e., the starting anchor is ignored.
