Qt app build from cmd-line as a .bat file

615 Views Asked by At

Am trying to automate a build process of an Qt app from a .bat file.

Am able to build a Qt app from cmd-line by entering each cmd one-by-one. Like qtenv2.bat, then vcvars64.bat, and then qmake. But when I put those cmd in a .bat file and try to execute the bat in cmd, strange is happening, ie, after qtenv2.bat runs, it doesn't proceed to the next cmd for vcvar64.bat, it quits the execution. The autoBuild.bat file is as below.

enter image description here

So when I run this in cmd, it's as below stops after qtenv2.bat

enter image description here

I want it to continue with the next cmds in the same console(it's a necessity for the build process) as below, where I run each cmds step-by-step. And the same is required from the .bat file.

enter image description here

I tried the following .... start "qtenv2" /min cmd /k call qtenv2.bat......but it started the process in a separate console, which I don't want.

Any suggestion, how to write the .bat file, so that qtenv2.bat runs and then vcvars.bat also runs in the same console with stopping the execution.

Regards, Sayan

1

There are 1 best solutions below

0
On

Changing between drives blocks your bat file to continue. Just add /D in cd command should help :

@echo "setting up Qt env..."
cd /D C:/a/b/c
qtenv.bat
@echo "going to working dir ..."
cd /D D:/works_dir/
$VC_FULL_PATH/vcvars64.bat
@echo "building now ...."
qmake && make clean
make