简体   繁体   English

如何使用Qt pro文件导出标头

[英]how to export headers using Qt pro files

I've a project with following files 我有一个包含以下文件的项目

TestProject/api/apiheader1.h
TestProject/api/apiheader2.h
TestProject/src/apiimplementaton.cpp
TestProject/inc/apiimplementation.h
TestProject/TestProject.pro

When the project TestProject.pro is built headers apiheader1.h, apiheader2.h needs to be copied to /usr/include/TestLib/. 当项目TestProject.pro构建头文件apiheader1.h时,需要将apiheader2.h复制到/ usr / include / TestLib /。 Is it possible to do this by specifying it in project file TestProject.pro.? 是否可以通过在项目文件TestProject.pro中指定它来执行此操作。

Any pointers / links will be helpful. 任何指针/链接都会有所帮助。

You can add this to the pro file... in qmake you can add extra targets...The copyheaders will get run once the target is built.. 您可以将其添加到专业文件...在qmake中您可以添加额外的目标...一旦构建目标,复制头就会运行。

QMAKE_EXTRA_TARGETS += copyheaders  
POST_TARGETDEPS += copyheaders  

copyheaders.commands += mkdir -p /usr/include/TestlLib  
copyheaders.commands += cp -f PATH_TO_HEADERS/apiheader1.h /usr/include/TestLib  
copyheaders.commands += cp -f PATH_TO_HEADERS/apiheader2.h /usr/include/TestLib  

Are you sure that you want to move the files? 您确定要移动文件吗? Moving source files around feels wrong. 移动源文件感觉不对。

As for doing it using qmake, you can use the system() function to simply cp the files in question. 至于使用qmake,你可以使用system()函数简单地cp有问题的文件。 http://pepper.troll.no/s60prereleases/doc/qmake-function-reference.html#system-command http://pepper.troll.no/s60prereleases/doc/qmake-function-reference.html#system-command

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM