Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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?

    [1] http://doc.qt.io/qt-5/qmake-advanced-usage.html


  • Lifetime Qt Champion

    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.

    https://github.com/giraldeau/qt-topic-81179


  • Lifetime Qt Champion

    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.


Log in to reply