Using Qt Creator and Project files, how do I copy a created dll/so with QMAKE_POST_LINK
This question appears to be answered in this tread
qmake: How do I copy .dll/.so's to the output directory?
but it does not work for me. I'm trying to do this within Qt Creator 2.0.1 with Qt SDK 4.7.0 on Windows 7
If I try:
QMAKE_POST_LINK=copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
on even a static file, the output I get is:
copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
process_begin: CreateProcess(NULL, copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt, ...) failed.
make (e=2)开发者_Python百科: The system cannot find the file specified.
If I try:
QMAKE_POST_LINK=cmd.exe /C copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
The output I get is:
cmd.exe /C copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
The system cannot find the file specified.
Does someone know the answer to this?
As the error message suggests the problem is in the path to the file you want to copy.
I created a simple .pro file and used the same command to copy a file - with the path changed accordingly - and it worked correctly.
QMAKE_POST_LINK=copy /Y .\hello.h .\debug\hello.h;
it's equivalent to
QMAKE_POST_LINK=copy /Y hello.h debug\hello.h;
With this command the file hello.h, in the same directory of the .pro file, is copied to the debug folder.
I got it!
Apprently the copy does not work if you start at the root of your drive. Go back and look at my example. I was starting at the root of my current drive. I also tried
QMAKE_POST_LINK=copy /Y $$PWD\MyFile $$PWD\anotherdir\MyFile
That did not work either.
Apprently you have to be relative to you directory???? I'm not sure what the real limitations are.
精彩评论