PDA

View Full Version : Copy built files to new location from a Qt Project file



gmat4321
17th December 2010, 05:32
I'm using a series of Qt Project files to build libraries on Windows, Mac and Linux platforms. Per platform I'd like to copy all the built library files into one location after they are built.

Using QMAKE_POST_LINK in the Project file seems to be the best way to do this. To keep things simple I wanted to use the same command on all platforms. I installed Cygwin on my Windows computer and tried to use 'cp' but I can't get it to work. I've tried it several ways.

If I try


QMAKE_POST_LINK=cp /Projects/TestFile.txt /Projects/OSPF/TestFile.txt

I get
cp: cannot stat `/Projects/TestFile.txt': No such file or directory


if I try (add '\' in middle):


QMAKE_POST_LINK=cp /Projects/TestFile.txt\ /Projects/OSPF/TestFile.txt

I get
cp: missing destination file operand after `/Projects/TestFile.txt /Projects/OSPF/TestFile.txt'

Does anyone know what I might be doing wrong?

Everall
17th December 2010, 22:10
You need to tell windows on what spot you want it :
Use eg. C:\map\file.txt or ..\map\file.txt

Try using backslashes everywhere also.

Everall

wysota
17th December 2010, 23:15
I use this:
dlltarget.path = $$[QT_INSTALL_BINS]
target.path = $$[QT_INSTALL_LIBS]
INSTALLS += target dlltarget

Then a simple "make install" does the trick. Of course adjust the paths to your liking.

gmat4321
18th December 2010, 04:56
Everall:
backslahes won't work with cygwin's 'cp'

wysota:
I not sure I can call 'make install'. I'm running from Qt Creator do a large build via SUBDIR and I'll need to move files around to automate testing.

Does anyone know the correct Windows/DOS command I can use with QMAKE_POST_LINK? I tried:

QMAKE_POST_LINK=cmd.exe /C copy \Projects\TestFile.txt \Projects\OSPF\TestFile.txt

and I get:
The system cannot find the file specified

What seems simple is turning out to be diffcuilt because the commands appear to be interpreted and not passed on directly.

wysota
18th December 2010, 08:08
I not sure I can call 'make install'. I'm running from Qt Creator do a large build via SUBDIR and I'll need to move files around to automate testing.
Sure you can. At least with recent versions of Creator. I think you can even invoke it automatically from qmake after building the project using QMAKE_POST_LINK but I'm not sure of that.