[CMake] Build flags when using Qt plugins (was: Where is QT_USE_IMPORTED_TARGETS not safe to use?)

Clinton Stimpson clinton at elemtech.com
Wed Jun 22 16:20:08 EDT 2011


On Wednesday, June 22, 2011 01:47:33 pm Stephen Kelly wrote:
> Clinton Stimpson wrote:
> >> The output is attached, but I'm not certain it's very helpful. Let me
> >> know if anything else would be useful. I can maybe try to create a
> >> smaller plugin using qt example for easy reproduction of the issue.
> > 
> > Also the files in templates/lib are not compiled with flags from
> > QT_USE_FILE. You can tell that by whether files are compiled with
> > -DQT_CORE_LIB.
> 
> Good catch. I'll remedy that and re-try.
> 
> In the mean-time I have created a CMake build system for the Qt echoplugin
> example. On my setup it fails to load the plugin at runtime unless I
> comment out the add_definition(-DQT_NO_DEBUG).
> 
> Could you try the same? That would at least show that it's a problem on my
> end.
> 

I tried the example, and if I use mingw, I have to set CMAKE_BUILD_TYPE to 
something for the example to work.

If I use nmake or visual studio, CMAKE_BUILD_TYPE is defaulted to Debug, so it 
just works.

So it seems one should fix the Platform/Windows-GNU.cmake or something to have 
something like a 
SET(CMAKE_BUILD_TYPE_INIT Release)
or
SET(CMAKE_BUILD_TYPE_INIT Debug)
Would you like to submit a bug for this?

As a workaround, you can enforce a value for CMAKE_BUILD_TYPE if on Windows 
and CMAKE_CONFIGURATION_TYPES is empty.  If you enforce that, then you don't 
need to have the add_definition(-DQT_NO_DEBUG).

-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com


More information about the CMake mailing list