From 98d01cbbb669b7c5ee37ad6e23b1626ac9cc4dbb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 18 Sep 2020 15:00:47 +0200
Subject: [PATCH] Provide a meaningful error message when 'use_dll' option is
 used without 'matlabroot'

---
 src/ModelTree.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index 1bbcb48c..47bef316 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -1978,6 +1978,12 @@ ModelTree::compileMEX(const string &basename, const string &funcname, const stri
   ostringstream flags;
   string libs;
 
+  if (matlabroot.empty())
+    {
+      cerr << "ERROR: 'matlabroot' option to preprocessor is not set, needed with 'use_dll'" << endl;
+      exit(EXIT_FAILURE);
+    }
+
   if (mexext == "mex")
     {
       // Octave
-- 
GitLab