Qmake and copying custom files before/after compilation
googie last edited by
I want to be able to copy any file I want from source directory to compilation directory (or any other). I've created a simple test function to do that:
message("copying $$absolute_path($$1) to $$absolute_path($$2)");
copy_target.commands = cp $$quote($$absolute_path($$1)) $$quote($$absolute_path($$2))
copy_target.commands = copy $$quote($$absolute_path($$1)) $$quote($$absolute_path($$2)) /y
QMAKE_EXTRA_TARGETS += copy_target
PRE_TARGETDEPS += copy_target
The problem is that "copy_target" is defined inside of the function and it cannot be exported, like regular variable would be. Therefore the copy_target is not visible outside and in the end the Makefile has empty definition of copy_target.
I've tried to use whole body of this function in global scope and it works fine. Only enclosing it in test function causes the problem.
There will also be a problem with uniqueness of target name, but this seems to be smaller problem, I'm not bothering it right now.
Any ideas how to export target to global scope? Or how do I do it in a different way? I want simple qmake function, like: