[Qt-creator] Creator doesn't shadow build (Core.json vs moc)

Daniel Teske daniel.teske at nokia.com
Thu Jul 12 14:36:54 CEST 2012

On Wednesday 11 Jul 2012 03:44:22 ext Lincoln Ramsay wrote:
> On 07/10/2012 06:31 PM, ext Oswald Buddenhagen wrote:
> > you take creator master from today and compile it yourself ...
> Creator generates a Core.json file but it puts this into $$OUT_PWD. moc
> does not look for .json files in $$OUT_PWD, only $$PWD so this breaks
> the build.
> Should moc look for .json files in $$OUT_PWD or should creator force the
> .json files to be created in the correct directory.
Good question. From a Creator standpoint, geenrating anything in the source 
directory for a shadow build is not ideal, but if moc expects it there, then 
so be it for now.
> My quick fix is this:
> --- a/src/qtcreatorplugin.pri
> +++ b/src/qtcreatorplugin.pri
> @@ -66,7 +66,7 @@ greaterThan(QT_MAJOR_VERSION, 4) {
>       pluginspec2json.name = Create Qt 5 plugin json file
>       pluginspec2json.input = PLUGINSPEC
>       pluginspec2json.variable_out = GENERATED_FILES
> -    pluginspec2json.output = $${TARGET}.json
> +    pluginspec2json.output = $$_PRO_FILE_PWD_/$${TARGET}.json
>       pluginspec2json.commands = $$XMLPATTERNS -no-format -output
> $$pluginspec2json.output $$PWD/pluginjsonmetadata.xsl $$PLUGINSPEC
>       pluginspec2json.CONFIG += no_link
>       moc_header.depends += $$pluginspec2json.output

If you upload that to gerrit, I'd test it and approve it if it works.

> However, both the original code and this code are still wrong because a
> source file may not be located in the same directory as the .pro file.
> The output for the .json should be related to the directory of the input
> file in some way.
That's a matter of convention for creator plugins, and okay.


More information about the Qt-creator mailing list