获取自定义构建步骤的包含目录

发布于 2024-12-07 16:21:09 字数 434 浏览 1 评论 0原文

我想知道在使用自定义构建步骤构建文件时是否有可能获取项目包含目录的列表。

想象一下以下情况:我的项目由 A.cppB.cppC.blah 组成。在项目属性中的“C/C++”字段下 -> “一般”-> “其他包含目录” 我已经指定了用于 A.cppB.cpp 的包含目录列表。现在,对于C.blah,我指定了一个自定义构建工具并写入“命令​​行”-> “mytool.exe C.blah -I*Direcotries?* -o C.obj”。现在如何获取此步骤中为 C/C++ 指定的包含目录列表?当我单击“宏”时,没有这样的宏为我提供完整的包含列表。

有人知道实现这一目标的可能性吗?

I would like to know if there is a possibility to get the list of project's include directories when building files with custom build step.

Imagine following situation: my project consists of A.cpp, B.cpp and C.blah. In project properties under the field "C/C++" -> "General" -> "Additional Include Directories" I have specified a list of includes directories to be used for A.cpp and B.cpp. Now for C.blah I do specify a custom build tool and write into "Command Line" -> "mytool.exe C.blah -I*Direcotries?* -o C.obj". How can I now get the list of include directories specified for the C/C++ in this step? When I click on "Macros" there is no such macro giving me the full list of includes.

Is anybody aware of a possibility to achieve this goal?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

向日葵 2024-12-14 16:21:09

我想我找到了答案,尽管不完整。

人们可以在属性表中指定如下内容:

<PropertyGroup>
    <ProjectIncludeDir>@(ClCompile->'%(AdditionalIncludeDirectories)')</ProjectIncludeDir>
</PropertyGroup>

这将使宏 $(ProjectIncludeDir) 可用于包含包含目录列表的自定义构建步骤。

这种方法的问题是,在此宏上不再可能进行字符串操作。例如,请考虑以下内容:

<ProjectIncludeDirDot>$(ProjectIncludeDir.Replace(';',','))</ProjectIncludeDirDot>

这会导致 @(ClCompile->'%(AdditionalIncludeDirectories)') 中的宏 $(ProjectIncludeDirDot)。似乎变换是在宏评估之后进行评估的,这打破了替换。如果有人知道更好的解决方案,请...

I think I found an answer, however incomplete.

One can specify in the property sheets something like this:

<PropertyGroup>
    <ProjectIncludeDir>@(ClCompile->'%(AdditionalIncludeDirectories)')</ProjectIncludeDir>
</PropertyGroup>

This will make the macro $(ProjectIncludeDir) available to the custom build steps too containing the list of include directories.

The problem with this approach that string operations are not possible on this macro anymore. For example consider following:

<ProjectIncludeDirDot>$(ProjectIncludeDir.Replace(';',','))</ProjectIncludeDirDot>

This results for the macro $(ProjectIncludeDirDot) in @(ClCompile->'%(AdditionalIncludeDirectories)'). It seems that transforms are get evaluated after the macro evaluation, which breaks that replacement. If somebody knows for a better solution, please...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文