Call the custom QMake function defined in the parent .pro file

I defined a simple qmake function as shown below:

defineReplace(generateBoilerPlate){        
     message("Generating boiler plate code...")
}

My project is organized in the following hierarchical way:

ProjectDir
    ProjectName.pro
    ModuleName1SubDir
         ModuleName1.pro
    ModuleName2SubDir
         ModuleName2.pro

I defined the above custom function in ProjectName.pro

I can successfully call this function in ProjectName.pro using:

out = $$generateBoilerPlate()

However, I want to be able to call the user-defined function generateBoilerPlate from the .pro files inside the module subdirectories (i.e., in the above example, I want to call the function in ModuleName1.pro and ModuleName2.pro).

When I try to call a function in the .pro files of the submodule files, I get the following error:

 'generateBoilerPlate' is not a recognized replace function.

Can anyone tell me how to achieve what I want?

+4
source share
1

.pri include .pro , .

+5

All Articles