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