Get Include Directories for custom build step

一个人想着一个人 提交于 2019-12-09 19:36:35

问题


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?


回答1:


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...



来源:https://stackoverflow.com/questions/7610538/get-include-directories-for-custom-build-step

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!