Albert
Albert

Reputation: 68110

Qmake 5.3: define global variable

For Qmake 4, I basically followed this guide to define some top_srcdir variable globally for all contained project files.

Now, I want to make my Qmake files also Qmake 5 compatible. It doesn't really work yet. The guide also tells me to create a file .qmake.conf with the content:

top_srcdir=$$PWD
top_builddir=$$shadowed($$PWD)

But it just seems to ignore that file. (Via Qt Creator, as a shadowed build, if that matters.)

If I specify the same in the root project file, it is not exported to any other project.

So, how can I export the variable such that it is available in all subprojects? Or how can I declare it globally for all projects?

Upvotes: 1

Views: 2392

Answers (1)

peppe
peppe

Reputation: 22724

There are fundamental differences between Qt 4 and Qt 5 that won't allow you to do that.

The best solution in your case is using a .pri file and include() it from your subdirs' .pro files.

And: in Qt 5, you should be using top_builddir=$$shadowed($$PWD) in your .qmake.conf, and not what you typed. In Qt 4, you should place a file called .qmake.cache inside your build dir, a bit complicated to do.

Upvotes: 1

Related Questions