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?
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?
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.
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.
I read and searched for hours and have not found anything that makes sense to me. I found this paragraph:
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.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.
Here is my .pro file:
And the resulting errors: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"))
}
I have no idea how to get the system command to where it is executed after the link is done successfully.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"
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.
Bookmarks