I have defined a simple qmake function as the one below:
defineReplace(generateBoilerPlate){
message("Generating boiler plate code...")
}
My project is arranged in the following hierachial manner:
ProjectDir
ProjectName.pro
ModuleName1SubDir
ModuleName1.pro
ModuleName2SubDir
ModuleName2.pro
I have defined the aforementioned custom function in ProjectName.pro
I am able to successfully call this function within ProjectName.pro using:
out = $$generateBoilerPlate()
However, I want to be able to call the custom function 'generateBoilerPlate' from within the .pro files inside the module subdirectories (i.e. in the example above, I want to call the function in ModuleName1.pro AND ModuleName2.pro).
When I try and invoke the function in the submodules' .pro files, I get the following error:
'generateBoilerPlate' is not a recognized replace function.
Can someone please tell me how to achieve what I want?
As possible solution, you can define your functions in separate .pri
file and include it in your .pro
files whenever you need your to use your functions.