Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qmake and copying custom files before/after compilation

Qmake and copying custom files before/after compilation

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    googie
    wrote on last edited by
    #1

    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);

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved