Results 1 to 3 of 3

Thread: Only copying files using qmake

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Only copying files using qmake

    I am using several 3rd party libraries in my application. Some of these are binary-only (dll's, for instance). I would like to create a "3rdparty.pro" that just copies some file across.
    However, I cannot seem to create a makefile that doesn't also want to compile something.

    For instance, I have created a test.pro that looks like this:

    Qt Code:
    1. mytarget.target = output.txt
    2. mytarget.commands = $(COPY) input.txt $$mytarget.target
    3. mytarget.depends = input.txt
    4.  
    5. QMAKE_EXTRA_TARGETS += mytarget
    6. POST_TARGETDEPS += output.txt
    To copy to clipboard, switch view to plain text mode 

    Now, it copies input.txt to output.txt correctly, so that's nice. But it will also try to compile (and link, if I don't specify CONFIG += no_link) test.cpp. How can I make a "copy-only" makefile?

    I have attached a very small test project to illustrate what I would like to do.
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2009
    Location
    ŁÃ³dź, Poland
    Posts
    20
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Only copying files using qmake

    If you want to install files (copy them with make install), the easiest way is to have it like this:

    Qt Code:
    1. mytarget.path = /some/output/path
    2. mytarget.files = input.txt
    3.  
    4. INSTALLS += mytarget
    To copy to clipboard, switch view to plain text mode 

    If you want to just copy them somewhere, you can try:

    Qt Code:
    1. QMAKE_POST_LINK = cp input.txt output.txt
    To copy to clipboard, switch view to plain text mode 

    If you have to link to the libraries, you'll probably stick to QMAKE_PRE_LINK.

  3. #3
    Join Date
    Jun 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Only copying files using qmake

    Thanks, the QMAKE_POST_LINK seems like a good bet, but that would copy the files always, instead of applying nice make rules.

    The "INSTALLS" path I noticed already but, as you mention, it will only do this on 'make install', whereas I want it to be done always. But that doesn't really matter, tbh. I don't mind simply always doing a 'make install', I guess.

Similar Threads

  1. Replies: 7
    Last Post: 30th May 2011, 09:34
  2. Replies: 4
    Last Post: 7th April 2010, 23:09
  3. QMake Project Files....
    By TemporalBeing in forum Qt Programming
    Replies: 2
    Last Post: 6th May 2009, 16:15
  4. qmake to copy bash scripts and other files
    By Nitz in forum Installation and Deployment
    Replies: 3
    Last Post: 27th January 2009, 22:46
  5. Mac: Copy Files Build Phase and qmake...
    By kuwan in forum Qt Programming
    Replies: 4
    Last Post: 25th September 2007, 20:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.