如此处所述完成:https ://stackoverflow.com/a/7810877/630169但是 make 说我:
make: `install' 不需要做任何事情。
并且没有复制任何内容来构建目录。Pro 文件包含以下行:
wav_files.path = %{buildDir}
wav_files.files += %{sourceDir}/hurray.wav
INSTALLS += wav_files
这是我用于复制其他运行时文件以构建路径和安装目标的内容:
在这里定义你的文件。
## === define copy files for installation and build ===
copytarget.path = /path/to/installation
copytarget.files += $$files(example/filename*)
## wildcard for filename1 filename2 filename3 ...
message("found files for copytarget: "$$copytarget.files)
你必须添加一个 qmake 编译器:
## === os specific dir separator ===
win32: copytarget.files ~= s,/,\\,g
## === copy compiler for makefile ===
DirSep = /
win32: DirSep = \\
for(f,copytarget.files) tmp += $$PWD$$DirSep$${f} ## make absolute paths
copycompiler.input = tmp
isEmpty(DESTDIR):DESTDIR=.
copycompiler.output = $$DESTDIR$$DirSep${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
copycompiler.commands = $(COPY_FILE) ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
copycompiler.CONFIG = no_link no_clean
## other CONFIG options are: depends explicit_dependencies target_predeps
copycompiler.variable_out = QMAKE_DISTCLEAN
QMAKE_EXTRA_COMPILERS += copycompiler
一个单独的makefile目标:
## == makefile copy target ===
copyfiles.recurse_target = compiler_copycompiler_make_all
copyfiles.depends = $$copyfiles.recurse_target
copyfiles.CONFIG += recursive
在源构建步骤之后附加目标:
QMAKE_EXTRA_TARGETS += copyfiles
POST_TARGETDEPS += copyfiles ## copy files after source compilation
包括运行时文件以安装目标
INSTALLS += copytarget