nareshmlx/opencv-pr huggingface dataset:
**File:** modules/matlab/generator/parse_tree.py
**Change Type:** modified
**Context:** PR #2403: fix issue 3451 - Python 3 support for Matlab bindings - This pull request adds Python 3 support to the Matlab bindings module, as requested ...

**Code Changes:**
```diff
@@ -1,6 +1,12 @@
-from string import join
+import collections
 from textwrap import fill
 from filters import *
+try:
+  # Python 2.7+
+  basestring
+except NameError:
+  # Python 3.3+
```

Review comment:
I think you should use `collections.Iterable` here.
**File:** modules/matlab/generator/parse_tree.py
**Change Type:** modified
**Context:** PR #2403: fix issue 3451 - Python 3 support for Matlab bindings - This pull request adds Python 3 support to the Matlab bindings module, as requested ...

**Code Changes:**
```diff
@@ -1,6 +1,12 @@
-from string import join
+import collections
 from textwrap import fill
 from filters import *
+try:
+  # Python 2.7+
+  basestring
+except NameError:
+  # Python 3.3+
```

Review comment:
I originally changed this because strings are Iterable in Python 3, which I'd have to add a special case for earlier in the piece. I'll rewrite it and add some tests to make sure it does what it should before updating my PR.
**File:** modules/matlab/generator/parse_tree.py
**Change Type:** modified
**Context:** PR #2403: fix issue 3451 - Python 3 support for Matlab bindings - This pull request adds Python 3 support to the Matlab bindings module, as requested ...

**Code Changes:**
```diff
@@ -1,6 +1,12 @@
-from string import join
+import collections
 from textwrap import fill
 from filters import *
+try:
+  # Python 2.7+
+  basestring
+except NameError:
+  # Python 3.3+
```

Review comment:
I've tried a number of other approaches, and they're all more complex than what I currently have. `collections.Iterable` is just too generic to match against, so I have to explicitly deal with other boundary cases. If you're hell-bent on having the most general `todict` implementation I can push my best set of changes, otherwise I'm happy to merge as is. ``` python def isstring(s): """ Check if variable is string representable (regular/unicode/raw) in a Python 2 and 3 compatible manner """ try: return isinstance(s, basestring) except NameError: return isinstance(s, str) def todict(obj, classkey=None): """ Convert the ParseTree to a dictionary, stripping all objects of their methods and converting class names to strings """ if isstring(obj): return obj if isinstance(obj, dict): obj.update((key, todict(val, classkey)) for key, val in obj.items()) return obj if isinstance(obj, collections.Iterable): return [todict(val, classkey) for val in obj] if hasattr(obj, '__dict__'): attrs = dict((key, todict(val, classkey)) for key, val in vars(obj).items()) if classkey is not None and hasattr(obj, '__class__'): attrs[classkey] = obj.__class__.__name__ return attrs return obj ```
**File:** modules/matlab/generator/parse_tree.py
**Change Type:** modified
**Context:** PR #2403: fix issue 3451 - Python 3 support for Matlab bindings - This pull request adds Python 3 support to the Matlab bindings module, as requested ...

**Code Changes:**
```diff
@@ -1,6 +1,12 @@
-from string import join
+import collections
 from textwrap import fill
 from filters import *
+try:
+  # Python 2.7+
+  basestring
+except NameError:
+  # Python 3.3+
```

Review comment:
I'll let you decide here. This is very localized code, after all, so use whatever works for you. Is the current state of the branch the version you want to push?
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 364

**Code Changes:**
```diff
@@ -393,6 +393,9 @@ if(WITH_OPENCL)
   include(cmake/OpenCVDetectOpenCL.cmake)
 endif()
 
+# --- Matlab/Octave ---
+include(cmake/OpenCVFindMatlab.cmake)
+
 # ----------------------------------------------------------------------------
 # Solution folders:
 # ----------------------------------------------------------------------------
@@ -829,6 +832,14 @@ if(NOT ANDROID)
 endif()
 status("    Java tests:"    BUILD_TESTS AND (CAN_BUILD_ANDROID_PROJECTS OR HAVE_opencv_java)            THEN YES ELSE NO)
 
+# ========================= matlab =========================
```

Review comment:
I'd prefer if you brought those lines back. They're obviously unrelated to Matlab. :smiley:
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -393,6 +393,9 @@ if(WITH_OPENCL)
   include(cmake/OpenCVDetectOpenCL.cmake)
 endif()
 
+# --- Matlab/Octave ---
+include(cmake/OpenCVFindMatlab.cmake)
+
 # ----------------------------------------------------------------------------
 # Solution folders:
 # ----------------------------------------------------------------------------
```

Review comment:
Any reason this isn't just a variable like all others?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
This variable is listed twice.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
The usual convention in CMake "find" scripts is X_INCLUDE_DIRS, even where there currently is only one directory, to ease updating if headers are split amongst several directories in the future. I'd suggest following it.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
The convention for libraries is X_LIBRARIES, with the variable containing full paths and so eliminating the need for a LIBRARY_DIR variable.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 41

**Code Changes:**
```diff
+# This function modifies the library prefixes and suffixes used by
+# find_library when finding Matlab libraries. It does not affect scopes
+# outside of this file.
+function(set_libarch_prefix_suffix)
+  if (UNIX AND NOT APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a" PARENT_SCOPE)
+  elseif (APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
+  elseif (WIN32)
```

Review comment:
This line is the same in all branches (except the implicit `else`, but I'm not sure if Matlab even exists anywhere else). Move it outside of the `if`, perhaps?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 42

**Code Changes:**
```diff
+# find_library when finding Matlab libraries. It does not affect scopes
+# outside of this file.
+function(set_libarch_prefix_suffix)
+  if (UNIX AND NOT APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a" PARENT_SCOPE)
+  elseif (APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
+  elseif (WIN32)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
```

Review comment:
Now, I can't pretend to know anything about Matlab, but does it really provide both static and shared libraries?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 48

**Code Changes:**
```diff
+  elseif (APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
+  elseif (WIN32)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" PARENT_SCOPE)
+  endif()
+endfunction()
+
+
+
```

Review comment:
You can't link directly against .dll files (well, I think MinGW can, but it can use import libraries just as well).
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 77

**Code Changes:**
```diff
+        list(REVERSE MATLAB_ROOT_DIR_)
+        list(GET MATLAB_ROOT_DIR_ 0 MATLAB_ROOT_DIR_)
+        set(MATLAB_ROOT_DIR ${MATLAB_ROOT_DIR_} PARENT_SCOPE)
+        return()
+      endif()
+    endforeach()
+
+  # --- WINDOWS ---
+  elseif (WIN32)
+    # 1. search the path environment variable
+    find_program(MATLAB_ROOT_DIR_ matlab PATHS ENV PATH)
```

Review comment:
I think the only difference between the two branches above is one directory in the search path. Merge them, perhaps?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 90

**Code Changes:**
```diff
+      # /path/to/matlab/rootdir/bin/matlab.exe
+      get_filename_component(MATLAB_ROOT_DIR_ ${MATLAB_ROOT_DIR_} PATH)
+      get_filename_component(MATLAB_ROOT_DIR_ ${MATLAB_ROOT_DIR_} PATH)
+      set(MATLAB_ROOT_DIR ${MATLAB_ROOT_DIR_} PARENT_SCOPE)
+      return()
+    endif()
+
+    # 2. search the registry
+    # determine the available Matlab versions
+    set(REG_EXTENSION_ "SOFTWARE\\Mathworks\\MATLAB")
+    set(REG_ROOTS_ "HKEY_LOCAL_MACHINE" "HKEY_CURRENT_USER")
```

Review comment:
Seems fragile. Why not use `find_program` (which uses the `PATH` variable, among other things) to find some Matlab program, and then determine the root from that?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
I think if `MATLAB_ROOT_DIR_` is empty, then this whole block starting from `#registry-hacking` does nothing. So perhaps move the first condition here to enclose the whole block? You still want to avoid setting `MATLAB_ROOT_DIR_` twice in the foreach loop, I guess, but you can just use `break` for that. Also, can you explain what the second condition means?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
Two branches here don't seem necessary, since Windows should be able to append .bat itself.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
`execute_process` has the `OUTPUT_STRIP_TRAILING_WHITESPACE` option. Or do you need to strip leading whitespace, as well?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
Any reason you're not using `find_program` here?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
This `return` does nothing.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
Incidentally, I don't think you ever use either of the `MATLAB_INCLUDE_DIR` or `MATLAB_LIBS`.
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 364

**Code Changes:**
```diff
@@ -393,6 +393,9 @@ if(WITH_OPENCL)
   include(cmake/OpenCVDetectOpenCL.cmake)
 endif()
 
+# --- Matlab/Octave ---
+include(cmake/OpenCVFindMatlab.cmake)
+
 # ----------------------------------------------------------------------------
 # Solution folders:
 # ----------------------------------------------------------------------------
@@ -829,6 +832,14 @@ if(NOT ANDROID)
 endif()
 status("    Java tests:"    BUILD_TESTS AND (CAN_BUILD_ANDROID_PROJECTS OR HAVE_opencv_java)            THEN YES ELSE NO)
 
+# ========================= matlab =========================
```

Review comment:
apologies for that _blushes_
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
I don't use them at the moment, but I still wanted OpenCVFindMatlab to be a good find_package script in case others ever want to use it. I was thinking of submitting it to KitWare once it's stable/reliable since their current one is terrible.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 41

**Code Changes:**
```diff
+# This function modifies the library prefixes and suffixes used by
+# find_library when finding Matlab libraries. It does not affect scopes
+# outside of this file.
+function(set_libarch_prefix_suffix)
+  if (UNIX AND NOT APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a" PARENT_SCOPE)
+  elseif (APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
+  elseif (WIN32)
```

Review comment:
Hmmm. I'm a bit torn on this one. I understand your logic, but I also like to be able to see at a glance exactly which options an architecture gets without having to multiplex the different code branches in my head
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 48

**Code Changes:**
```diff
+  elseif (APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
+  elseif (WIN32)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" PARENT_SCOPE)
+  endif()
+endfunction()
+
+
+
```

Review comment:
I don't link against them directly, but it's still nice to know where and what type they are in a general package finding script.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
I've put return statements where necessary, so the extra conditions are not necessary. The `${QUERY_RESPONSE_} MATCHES "registry$"` condition is because the registry returns `/registry` rather than an empty string when no value for the key is found
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
fixed for both mex and matlab
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 48

**Code Changes:**
```diff
+  elseif (APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
+  elseif (WIN32)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" PARENT_SCOPE)
+  endif()
+endfunction()
+
+
+
```

Review comment:
I find your logic dubious here. You're searching for libraries to link to; isn't searching for dll files not only useless, but potentially harmful if they're found instead of the ones you wanted?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 12

**Code Changes:**
```diff
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
+#   MATLAB_MEX_SCRIPT:  The mex script used to compile mex files
+#   MATLAB_INCLUDE_DIRS:Path to "mex.h"
+#   MATLAB_LIBRARY_DIRS:Path to mex and matrix libraries
+#   MATLAB_LIBRARIES:   The Matlab libs, usually mx, mex, mat
+#   MATLAB_MEXEXT:      The mex library extension. It will be one of:
+#                         mexwin32, mexwin64,  mexglx, mexa64, mexmac,
+#                         mexmaci,  mexmaci64, mexsol, mexs64
+#   MATLAB_ARCH:        The installation architecture. It is **usually**
```

Review comment:
I think `MATLAB_LIBRARIES` has full paths, so you don't need `MATLAB_LIBRARY_DIRS`.