[SOLVED] Q_EXPORT_PLUGIN2 vs. $$qtLibraryTarget()
Hi all,
I have a plugin foo that I build to TARGET = $$qtLibraryTarget(foo). This implies that under Windows, the debug plugin is named food.dll (mark the trailing 'd' character).
I use Q_EXPORT_PLUGIN2(PluginName, FooClass) to export the plugin class. As the doc states:
Quote:
The value of PluginName should correspond to the TARGET specified in the plugin's project file.
So the 1st parameter to Q_EXPORT_PLUGIN2 needs to fit the appropriate build configuration.
Of course I could use #ifdef to preprocess with a different macro parameter depending on the configuration. However, I dislike this option as it requires manual synchronization between plugin implementation source and .pro file.
Is there a better way to automagically adopt Q_EXPORT_PLUGIN2's PluginName to the TARGET?
Thank you for your help and proposals.
Re: Q_EXPORT_PLUGIN2 vs. $$qtLibraryTarget()
I think using "foo"in Q_EXPORT_PLUGIN2() should be fine.
For example the GIF image format plugin of Qt does it like this:
gif.pro:
Code:
TARGET = qgif
include(../../qpluginbase.pri)
qpluginbase.pri:
Code:
TARGET = $$qtLibraryTarget($$TARGET)
main.cpp:
Code:
Q_EXPORT_PLUGIN2(qgif, QGifPlugin)
[SOLVED] Q_EXPORT_PLUGIN2 vs. $$qtLibraryTarget()
Thx jpn, you're right.
My build environment was in a state where I could only load the plugin when I put the trailing 'd' to PluginName in Q_EXPORT_PLUGIN2. Maybe some plugin cache issue?
Anyway, i did a major cleanup and everything works as expected. No need to take care of the configuration there explicitly.
Sorry for stirring up.