[CMake] Automatically pull in dependencies from QtDesigner plugins

Michael Jackson mike.jackson at bluequartz.net
Sun Dec 4 11:34:07 EST 2011


Do you have "MyWidget" packaged as a true library, or did you just create the Designer Plugin and then have a "loose" .cpp/.h file? 

  The is a project called Qwt* that has a similar setup. It has a Designer plugin for its various widgets and it has a qwt.dylib/.dll/.so that your program links against. You might be able to use this type of workflow for your project. In rough form this is what I am suggesting:

Create a MyWidget project that builds the Designer plugin and a dynamic library. When the project "installs" it will install its headers and library under its own install location and also install the Designer plugin into the appropriate location inside the Qt distribution you are using. The MyWidget would also include the necessary CMake EXPORT files or what ever so other projects can use it.

In the project that actually _uses_ MyWidget, you call "find_package(MyWidget)" which will setup all the necessary include directories and "MyWidget_LIBRARIES" variables.

*Normal Qwt at Sourceforge does NOT use CMake as a build system. I have created a CMake build system for Qwt which is located on my public git-web server.

Hope some of that helps.
___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net 
BlueQuartz Software               Dayton, Ohio

On Dec 4, 2011, at 10:07 AM, David Doria wrote:

> I have created a QT widget, MyWidget, and a QtDesigner plugin for
> MyWidget. Now I want to use MyWidget in bigger project, MyProject. I
> created a ui file for MyProject with QtDesigner and add a MyWidget in
> the designer. Now when I try to compile MyProject, I get (of course)
> "error: can't find MyWidget.h". Is there any way to automatically pull
> in dependencies from qtdesigner plugins? Or would I have to manually
> copy MyWidget.h/cpp into the MyProject directory?
> 
> One non-portable solution (it would only build on my machine with the
> plugin installed) would be to add
> QT_INSTALL_EXAMPLES/designer/MyPlugin to include_directories. However,
> that qmake variable QT_INSTALL_EXAMPLES does not seem to be defined in
> cmake. Is there anything similar?
> 
> Can anyone describe a typical workflow for doing this?
> 
> Thanks,
> 
> David
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list