ZED SDK compatibility with MATLAB (error with MEX file)

I am having trouble creating a MEX file for compatibility between ZED SDK and MATLAB. I have been following along with the build procedure outlined in the documentation liked here How to Use Matlab with ZED | Stereolabs

CMake was unable to find the path to MATLAB so I created an environmental variable with the proper path. I thought this would fix the issue but after attempting to configure the file I was given the error displayed in the following in the attached image. I don’t know why it would ignore the environment variable. Any help would be greatly appreciated.

I am using Matlab 2023a along with CUDA 11.6 and ZED SDK 3.8.2 and Visual Studios 17 2022

it looks like cmake is not taking the env var into account.
Can you define it diretcly into the cmake UI? like in this case: Cmake not finding matlab · Issue #23 · stereolabs/zed-matlab · GitHub

In the same time I will check how to fix the cmake to support it directly

Tested, with an env var:

when calling using cmake to generate the project it is directly found and used:

In your case is it really an error or just a warning ?
it looks like you can click en generate? what happens next?

I tried defining it directly and it worked, cmake took the env var when defined directly. It generated fine and could be opened in Visual Stuido. However when built in Visual studios it threw multiple errors and only built 1 out of 2. I tried rebuilding it but to no success. The output from build is listed below.

I will try repeating the entire process from the beginning and if it works ill add an update. Thank you for all your help.

the current master branch is related to the SDK version 4.0 EA.
if you want to use it with a 3.8 version you should pull this: Release V3.8 · stereolabs/zed-matlab · GitHub