[CMake] Pointing CMAKE_AUTOMOC to a custom version of Qt and its moc.exe
Konstantin Tokarev
annulen at yandex.ru
Mon Nov 7 10:54:16 EST 2016
07.11.2016, 18:49, "Saad Khattak" <saadrustam at gmail.com>:
> 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).
>
> I have the following issues:
>
> (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.
You should be able to use custom Qt installation by setting CMAKE_PREFIX_PATH to your Qt prefix
>
> (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.
>
> 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.
>
> 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:
>
> m_button = new QPushButton("MyButton"); // where m_button is a QPointer<QPushButton>
> delete m_button; // causes heap corruption debug assertion to fire
>
> 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.
>
> Thanks.
>
> ,--
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
--
Regards,
Konstantin
More information about the CMake
mailing list