Important: Please read the Qt Code of Conduct -

[SOLVED] "make arguments" via qmake?

  • I'm trying to set a make argument via the .pro file. From the qmake reference, I believed it should be QMAKE_CXXFLAGS, but the value I add there never appears in the "make arguments" field in Qt Creator.

    Which qmake variable do I have to use?

  • Moderators

    Make arguments in Qt Creator (Projects pane) are independent from ones set in qmake .pro file. qmake does not invoke make, by the way, it only generates the Makefile.

  • So if Qt Creator loads a .pro file (and assuming no .pro.user file exists), it simply ignores my settings?

    I am aware that qmake does not invoke the make itself.
    But basically, all I need is for my flag to appear in the makefile.

  • Moderators

    Tobias would have to fill in the details. You can definitely use CXXFLAGS to add compiler flags to Makefile. I don't know about adding other flags. You can get all available vars from "the reference":

    MAKEFILE var is nice to look at - it allows to change the name of the makefile, so that you can use your own "main" file with standard name.

  • QMAKE_CXXFLAGS is only a part of what I need.

    I need to be able to define make arguments, basically append to the environment variable MAKEFLAGS.
    How would I do that with qmake commands?

  • Moderators

    DEFINES is a good start. As hinted above, I don't know how to do it cleanly. You can use the MAKEFILE variable trick (create your own Makefile with flags set, tell qmake to generate something like temp_makefile, link both files and voila) - it's nasty, but should work.

  • The way I understand it, DEFINES is something different than an environment variable, and the make won't see it. Also, there does not seem to be a flag in qmake at all to pass on "makeflags", so the second best option would be for me to define an environment variable.

    All I have that I give the compile server is the .pro file, so the environment variable would need to be set by qmake based on some function or variable within my .pro file.

  • Found a way to pass the option as a command line argument. Solved for me. Thanks!

  • How?

  • Unfortunately, I don't remember and even after a lengthy search did not find what my original problem was. Sorry!

    I have since learned to post my own solutions to my own threads.

  • @Asperamanca Can you please tell me how did you pass a variable to qmake?


Log in to reply