April 15, 2011

RickF RickF
Lab Rat
9 posts

Custom Build Process on Windows

 

I’m trying to write a custom build step that will copy a config file to the application’s directory.

I have Enable custom process step checked
Name: Custom Process Step
Command: cmd
Working Directory: $BUILDDIR
Command arguments PostBuild.bat

My .bat file is:

  1. copy copy.xml $DESTDIR
  2. echo Copied copy.xml
  3. exit

When I build the build process hangs with the output:

The process “C:/Qt/2010.04/mingw/bin/mingw32-make.exe” exited normally.
Starting: “C:/Windows/system32/cmd.exe” PostBuild.bat
Microsoft Windows [Version 6.1.7600]
Copyright © 2009 Microsoft Corporation. All rights reserved.

It never exits. Does anyone know what I might be doing wrong?

Thanks

2 replies

May 3, 2011

ludde ludde
Robot Herder
298 posts

Have you tried running the same thing from a command prompt? If you do, you will notice that exactly the same thing happens – a new command prompt is started and your .bat file is not used at all. The reason is that cmd simply does not work the way you think – to pass a .bat file you have to use the /c command line option. So changing the command arguments to /c PostBuild.bat should do what you want (if PostBuild.bat is placed where cmd expects to find it).

May 3, 2011

Gerolf Gerolf
Mad Scientist
3005 posts

There is another problem:

you batch file will not work.
You should try out the batch file from a command propt to verify it’s usage. $DESTDIR is a qMake and perhaps QtCreator variable, but none for a batch file. Inside batch files, you must use windows syntzax for variables: VARNAME

perhaps some of the following pages might help:

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

 
  ‹‹ StyleSheet issues with MainWindow, Menu      QTcpServer with QThreadPool, for long term connections. ››

You must log in to post a reply. Not a member yet? Register here!