Important: Please read the Qt Code of Conduct -

Automatic project file parsing VS qmaking manually

  • Does anyone know why I don't get the same output when QT Creator parse the project files (.pro) and it's subdirs versus when I run manually qmake on the main project file?

    I wonder if I can detect it my pro (or pri) file. The reason why I want to do that, is that my pri files tells the programmers to changes some settings if it detects an error. When I manually run qmake, the qmaking process is stop on the first error("my message to programmers"). But when the project is loaded, the error message is written for all the subdirs in the General Messages outputs. Is there a way to control what is send to General Messages vs what is in Compile Output.

    Is there a way to know that qmake was called by QTCreator or by me? I tried using QMAKE_ARGS. I found that no arguments are written when executed by QTCreator. This is the only I found a different behavior...

    Thank you!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you show a minimal .pro/.pri file that triggers this behaviour ?

  • Creator does not call qmake to get the project data. It just uses the same parser that is built into qmake -- but in a different way. Creator will basically parse your .pro-file twice. Once it does something very similar to what happens when you run qmake. The second time it basically ignores all conditions to get all the files that belong to the project but are not built in the current configuration. Think foo_unix.cpp on Windows or foo_windows.cpp on Mac. Creator will not create files in both nodes!

    So Creator should only trigger one error in exact mode and all of them in inexact mode.

    When you start to build your project, then Creator will run the real qmake and at that point you should get the warnings as you expect them.

Log in to reply