Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

qmake and copying custom files before/after compilation

$
0
0
Hi, 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: defineTest(copy_file) {    message("copying $$absolute_path($$1) to $$absolute_path($$2)");    unix: {            copy_target.commands = cp $$quote($$absolute_path($$1)) $$quote($$absolute_path($$2))    }    win32: {            copy_target.commands = copy $$quote($$absolute_path($$1)) $$quote($$absolute_path($$2)) /y    }    QMAKE_EXTRA_TARGETS += copy_target    PRE_TARGETDEPS += copy_target    export(PRE_TARGETDEPS)    export(QMAKE_EXTRA_TARGETS) } 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: copy_file(srcFile, dstFile);

Viewing all articles
Browse latest Browse all 13965

Trending Articles