Reputation: 51
Is there any way to specify in .vsprops file paths relative to .vsprops file directory?
For example, I have the followind directory stucture:
largesolution.sln
a/a.vcproj
b/c/c.vcproj
common/common.vsprops
Both a.vcproj
and c.vcproj
include common.vsprops
, and I want to add some macro or set include directory relative to common
folder regardless the solution directory both projects are included to. I've tried using $(InputDir)
in .vsprops file, but it seems this macro is expanded as directory containing .vcproj, not .vsprops file.
Setting absolute paths or setting global include path in Visual C++ Directories is not a solution because different developers have different location of the source tree root. Setting paths relative to $(SolutionDir)
does not suit because it is useful to have smaller solutions containig some subset ob projects (for example, a.vcproj only) somewhere outside main sources tree.
Of course, setting include directory in a.vcproj
to $(ProjectDir)..\common
works fine, but the result to be achieved is only including .vsprops and having paths set correctly.
Upvotes: 4
Views: 1345
Reputation: 980
You can use MSBuildThisFileDirectory macro. For example: You set Include Directories to "$(MSBuildThisFileDirectory)\include;$(IncludePath)" in common.props.
See http://msdn.microsoft.com/en-us/library/vstudio/ms164309.aspx for details.
Tested with MSVS2012 and MSVS2013.
Upvotes: 2