<div dir="ltr">I am working on a plugin for Maya and it uses a customized version of Qt. Maya's SDK comes with everything to build Qt (headers, libraries and customized Qt tools such as moc.exe).<div><br></div><div>I have the following issues:</div><div><br></div><div>(1) With CMAKE_AUTOMOC set to ON, I am unable to figure out how to point CMake to pick Maya's version of moc.exe (and other Qt utils). The result is that I get linking errors since the moc did not run - which I expected.</div><div><br></div><div>(2) Maya uses a modified version of Qt 5.6.1. There is currently no way to get that version from Autodesk. So I downloaded the official Qt 5.6.1 distribution. CMAKE_AUTOMOC now sets up my project correctly to be MOC'ed. However, it is using the official Qt moc utilities and NOT Maya's customized moc. The headers and libraries being used were still from Maya's custom Qt.</div><div><br></div><div>The reason (2) worked is because I put "find_package(Qt5Widgets REQUIRED)" after installing the official version of Qt 5.6.1. However, I did NOT use the official Qt headers or libraries - instead, I used Maya's custom version of Qt 5.6.1.</div><div><br></div><div>Using solution (2) I successfully compile and link my Qt enabled Maya plugin and load it in Maya. Things go smoothly until I either (a) unload the plugin or (b) delete any widget. I looked at the simplest code that is causing a heap corruption debug assertion:</div><div><br></div><div><span style="color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif;font-size:13px">m_button = new QPushButton("MyButton"); // where m_button is a QPointer</span><span style="color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif"><QPushButton></span></div><div><span style="color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif;font-size:13px">delete m_button; // causes heap corruption debug assertion to fire</span><br></div><div><span style="color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif;font-size:13px">A few other people have gone through similar issues but since they didn't use CMake, they simply ran Maya's moc utilities in a build step. I would like a solution where I can get CMAKE_AUTOMOC to run the custom Qt version.</span></div><div><span style="color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif;font-size:13px">Thanks.</span></div><div><br></div></div>