简体   繁体   English

如何在QMAKE中为头文件创建相对路径

[英]How do I make a relative path for header files in QMAKE

I am able to use the QMAKE_POST_LINK = copy address\\goes\\here.h and\\pastes\\here.h but want to take the original address as a relative path. 我能够使用QMAKE_POST_LINK = copy address\\goes\\here.h and\\pastes\\here.h但希望将原始地址用作相对路径。 I tried something like this… 我尝试过这样的事情……

HEADERS += -L”$$PWD/header.h” -header.h 

QMAKE_POST_LINK = copy -H”$$PWD\header.h” -header.h C:\really\long\address\goes\here\header.h;

this didn't work, so I tried something like this from a library relative path example I found earlier like so… 这行不通,所以我从我之前发现的类似的库相对路径示例中尝试了类似的方法……

QMAKE_POST_LINK = copy -L”..\header.h” -header.h C:\really\long\address\goes\here\header.h;

Does anyone know how to copy a header file using a relative path approach? 有谁知道如何使用相对路径方法复制头文件? Or is it simply impossible? 还是根本不可能?

Some time ago i implement a shared precompiled header, i used the following approach to copy a .pdb file to a other directory: 前一段时间,我实现了一个共享的预编译头,我使用以下方法将.pdb文件复制到另一个目录:

In .qmake.conf: 在.qmake.conf中:

root_dir = $$PWD

In .pro File: 在.pro文件中:

QMAKE_PRE_BUILD += xcopy /D /Y "$$root_dir\\src\\precompilemfc\\debug\\vc100.pdb" "$(ProjectDir)\\debug" &

Look here . 这里 PWD or _PRO_FILE_PWD_ are the correct way to do what you want. PWD或_PRO_FILE_PWD_是执行所需操作的正确方法。

In qt do not use "\\", use "\\\\" or better "/" instead. 在qt中,请勿使用“ \\”,而应使用“ \\\\”或更佳的“ /”。

This should work: 这应该工作:

QMAKE_POST_LINK = copy "$$PWD\\header.h" C:\\really\\long\\address\\goes\\here;

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

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