What is the most portable way of copying a file to the output project directory?
I want to copy an XML file to the output directory (debug/release). I don't want to do it using the resource syst开发者_StackOverflow中文版em because this doesn't allow me to modify the file without recompiling. 5314464 shows how to open the file in a portable way, but I couldn't find a good solution for copying it (obviously I want to automate this somehow). Solutions like 1740534 suggest using the copy command of each operating system but perhaps there is a better solution.
Try using the INSTALLS keyword in your qmake file. (See QMake Reference on INSTALLS)
stuff_to_copy.path = /path/to/put/it/in
stuff_to_copy.files += file1
stuff_to_copy.files += file1
INSTALLS += stuff_to_copy
Having done this, you will need to run "make install" as part of your build process to actually cause the files to be copied.
精彩评论