[CMake] Build flags when using Qt plugins (was: Where is QT_USE_IMPORTED_TARGETS not safe to use?)
Stephen Kelly
steveire at gmail.com
Wed Jun 22 17:51:10 EDT 2011
Clinton Stimpson wrote:
> 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?
Thanks for looking into it. Submitted as
http://public.kitware.com/Bug/view.php?id=12301
>
> 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).
>
Thanks for the pointer. I'll try setting that in the cache before calling
project() as described here:
http://www.cmake.org/pipermail/cmake/2008-September/023808.html
All the best,
Steve.
More information about the CMake
mailing list