Get Include Directories for Custom Build Step

I would like to know if it is possible for the list of projects to include directories when creating files with a custom build step.

Imagine the following situation: my project consists of A.cpp , B.cpp and C.blah . In the project properties in the field "C / C ++" → "General" → "Additional inclusion directories" I have specified a list of included directories that will be used for A.cpp and B.cpp . Now for C.blah . I point out the custom build tool and write in "Command Prompt" → "mytool.exe C.blah -I * Direcotries? * -O C.obj". How can I now get the list of included directories specified for C / C ++ in this step? When I click "Macros", such a macro does not provide me with a complete list of inclusions.

Does anyone know about the possibility of achieving this goal?

+2
source share
1 answer

I think I found the answer, however incomplete.

You can specify something like this in the properties:

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

This will cause the $ (ProjectIncludeDir) macro to be available for custom build steps that also contain a list of included directories.

The problem with this approach is that string operations on this macro are no longer possible. For example, consider the following:

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

This is the result of the macro $ (ProjectIncludeDirDot) at @ (ClCompile → '% (AdditionalIncludeDirectories)'). It seems that the transforms are calculated after a macro evaluation, which violates this replacement. If someone knows for a better solution, please ...

+3
source

Source: https://habr.com/ru/post/909515/


All Articles