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

Please help me with .qmake.cache



  • I have two similar projects. Both use several same subprojects. I need set the switch in one of top projects and then make conditional build in subprojects depending of this switch. Say one project has ADVERTIZING = true but other not. I need get this value inside subproject header file. Qmake still cannot translate variables from project to subproject in natural way. But Qt5 has .qmake.cache file feature as I read in Web. Unfortunately I cannot get it working. I created zero length .qmake.cache file in directory with both top project files. All project and subproject drectories are nested in it too. In top project I wrote

    ADVERTIZING = true
    cache(ADVERTIZING, set, ADVERTIZING).
    

    I expected after qmake parsing or while building the .qmake.cache will get some text with variable ADVERTIZING set to true. But size of .qmake.cache remains 0. Whatever I did.

    What can be wrong? I use Qt 5.12.5 with all default settings after installation. No any settings was changed.



  • Just solved... The error was - I tried set value for cache file not inside top project file but inside "heading" subproject. When I moved both lines to top project - all began work fine. The cache() statement must be in project file before subprojects definition.


Log in to reply