Results 1 to 5 of 5

Thread: After build I want it to ask me if I want to copy the file to my bin directory.

  1. #1

    Default After build I want it to ask me if I want to copy the file to my bin directory.

    I would like to add a command in the project .pro file that will ask me if I want to copy the executable file to my bin directory after I have a successful build.
    Is this possible? How?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,229
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: After build I want it to ask me if I want to copy the file to my bin directory.

    You should probably set a different build target ("install", maybe). The Advanced Usage section of the qmake manual may give some help.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3

    Default Re: After build I want it to ask me if I want to copy the file to my bin directory.

    I don't want to change the build target directory, but have it ask if I want to copy the executable to my bin, and only do so if I say 'Yes'.
    I would prefer to have the code to do this in my project .pro file.

  4. #4

    Default Re: After build I want it to ask me if I want to copy the file to my bin directory.

    Quote Originally Posted by d_stranz View Post
    You should probably set a different build target ("install", maybe). The Advanced Usage section of the qmake manual may give some help.
    I read and searched for hours and have not found anything that makes sense to me. I found this paragraph:

    More complex operations on variables that would usually require loops are provided by built-in functions such as find, unique, and count. These functions, and many others are provided to manipulate strings and paths, support user input, and call external tools. A list of the functions available can be found in the qmake Advanced Usage chapter of this manual.
    But when I search the 'Advanced Usage chapter' I find no reference to 'support user input' or 'call external tools'. I did however find some info about the system() function, but I cannot figure out how to get it to work.

    Here is my .pro file:
    CONFIG *= c++latest cmdline
    CONFIG -= app_bundle

    DEFINES += QT_DEPRECATED_WARNINGS

    INCLUDEPATH += /home/hab/AImg/AH

    SOURCES += main.cpp \
    dspkl.cpp

    CONFIG(release, debug|release) {
    message("Release build - Post Link Step")
    QMAKE_POST_LINK += $$quote(system("AskToBin"))
    }
    And the resulting errors:
    g++ -Wl,-O1 -Wl,-rpath,/opt/Qt/5.9.2/gcc_64/lib -o imgfx main.o dspkl.o -L/opt/Qt/5.9.2/gcc_64/lib -lQt5Gui -lQt5Core -lGL -lpthread
    system("AskToBin")
    Makefile:246: recipe for target 'imgfx' failed
    /bin/sh: 1: Syntax error: word unexpected (expecting ")")
    make: *** [imgfx] Error 2
    19:28:48: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project imgfx (kit: Desktop)
    When executing step "Make"
    I have no idea how to get the system command to where it is executed after the link is done successfully.

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,229
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: After build I want it to ask me if I want to copy the file to my bin directory.

    qmake generates a Makefile, which Qt Creator uses to control the build. Makefiles are not interactive (or at least I am not aware of how one can be made to be interactive.

    When I said "set a different build target", I did not mean tell the output to go to a different directory. Instead, what I meant was to provide another set of instructions that you execute separately from your build:

    make target <- builds the executable
    make install <- copies it to your output directory

    I think your confusion is that you think .pro file are scripts, like a BAT file in Windows or a shell script in *nix. They aren't. They are a set of instructions qmake uses for building a makefile. qmake doesn't execute them, it reads them and translates them into make commands.

    If you want something that has all of the bells and whistles you seem to want, you should look at cmake. Steep learning curve, but I haven't found anything I couldn't get it to do.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 15
    Last Post: 13th January 2019, 16:59
  2. Replies: 2
    Last Post: 30th January 2015, 18:56
  3. Replies: 2
    Last Post: 15th July 2010, 13:45
  4. QT 4.5.1 failed to build with gtk/gtk.h: No such file or directory
    By doggrant in forum Installation and Deployment
    Replies: 5
    Last Post: 28th August 2009, 16:55
  5. Replies: 4
    Last Post: 24th February 2006, 11:30

Tags for this Thread

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.