qmake does not read prf file located in project root directory
-
The qmake documentation [1] indicates that .prf files lookup includes the project root directory. However, it looks like it's not the case with qmake 3.1. Using strace, I confirm that the file is not read unless the path is added to QMAKEFEATURES property.
With myfeatures.prf is inside the project root directory in project.pro: CONFIG += myfeatures $ strace qmake ../scratchpad-virtuel/ 2>&1 | grep myfeatures.prf stat("/home/francisg/Qt5.9.0/5.9/gcc_64/mkspecs/features/unix/myfeatures.prf", 0x7ffddc3b2f70) = -1 ENOENT (No such file or directory) stat("/home/francisg/Qt5.9.0/5.9/gcc_64/mkspecs/features/myfeatures.prf", 0x7ffddc3b2f70) = -1 ENOENT (No such file or directory) Setting the property: qmake -set QMAKEFEATURES /path/to/project $ strace qmake /path/to/project 2>&1 | grep myfeatures.prf stat("/path/to/project/myfeatures.prf", {st_mode=S_IFREG|0644, st_size=881, ...}) = 0 open("/path/to/project/myfeatures.prf", O_RDONLY|O_CLOEXEC) = 3
Actually, by adding the variable in
.qmake.conf
at the project root directory, the file is read:QMAKEFEATURES=$$PWD
Maybe we can update the doc?
-
Hi,
Sounds rather like it could be a bug.
Do you have a minimal compilable example that shows this behaviour ?
Just in case, 5.9.1 got released last week so it might be worth checking before going further.
-
Here is a minimal example to reproduce the problem. By removing the .qmake.conf file, the message "inside myfeatures.prf" will not be written when calling qmake.
-
Following QTBUG-21411, it could be a documentation issue but it's not really clear.
In any case, one workaround could be to use a features folder in your project. Might not be ideal but should be working on all platforms.
-
@SGaist
Yes, I am well aware this old! I have been struggling with this --- trying to put amyfeatures.prf
file into same directory as my.pro
file (under Linux, if it makes any difference).I tried putting it in the project/
,pro
file directory, a sub-directory namedfeatures
and a sub-sub-directory namedmkspecs/features
.qmake
does not pick up any of these. The only thing I found which does work is in the project/.pro
file directory do atouch .qmake.cache
. Then it does read it! Though I have no idea what any side-effects of creating this file might be for anything else.....UPDATE
After cleaning up I was unable to make it work again. I now find that in addition to creating a.qmake.cache
in the project/.pro
folder you must put thefeatures.prf
file down inmkspecs/features/
from there. Both of these are necessary:project.pro .qmake.cache mkspecs/features/myfeature.prf
-
@JonB said in qmake does not read prf file located in project root directory:
I now find that in addition to creating a .qmake.cache in the project/.pro folder
This makes no sense. This file is created by
qmake
for internal purposes. Could you repeat your last attempt with this file removed and confirm this file is required? -
I confirm that the mentioned solution does not work (on windows). Neither creating a
.qmake.cache
nor putting the feature file anywhere in the project tree causedqmake
to find it. The only way, which reliably works, is to install it in$$[QT_INSTALL_DATA]/mkspec/features
. -
@kshegunov sounds like the bug is still alive so either the documentation needs to be fixed again or qmake.