c++ - Copy exe file to Qt build directory -
i trying write qt application use qprocess
call ffmpeg.exe
convert media files. cannot figure out best way make sure ffmpeg.exe
file gets copied development directory build directory built (and later deployed) application have access it.
i have seen information using installs
parameter in .pro file (https://stackoverflow.com/a/13168287) qmake docs say:
note qmake skip files executable.
with of above said, how should 1 go making sure exe file want use qprocess
ends in build directory (ready deployed later)?
you can use qmake_post_link
execute copy command when application built. put in .pro file :
win32:{ file_pathes += "\"$$pwd/path/to/files/ffmpeg.exe\"" config(release, debug|release):{ destination_pathes += $$out_pwd/release/ destination_pathes += path/to/deploy/directory } else:config(debug, debug|release):{ destination_pathes += $$out_pwd/debug/ } for(file_path,file_pathes){ file_path ~= s,/,\\,g for(dest_path,destination_pathes){ dest_path ~= s,/,\\,g qmake_post_link += $$quote(xcopy $${file_path} $${dest_path} /i /y $$escape_expand(\n\t)) } } }
you should add paths files want copied file_pathes
variable , paths destination directories destination_pathes
variable. files copied destinations when application built.
here ffmpeg.exe
gets copied application build , deploy directories in release mode , build directory in debug mode.