I have a set of property sheets which define include and link paths for commonly used 3rd partly libraries in my c++ project. Is there a way to also define PATH in those pages for the executable to find the binaries when I fire it up in a debugger ?
Edit: I noticed that if I add the following to a property sheet (via notepad)
<PropertyGroup>
<VCRedistPaths>c:\path\bin\$(Platform);$(VCRedistPaths)</VCRedistPaths>
</PropertyGroup>
Then I get c:\path\bin\Win32 (for instance) path appended when app is run under debugger, but the problem here is that visual studio doesn't detect my changes instantly (if I change the path in property sheet or append another property sheet with another path) and I have to restart visual studio for the changes to pickup. Anyone knows if this is possible to avoid ?
Here is an example property sheet that worked for me in VS2010:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<LocalDebuggerEnvironment>PATH=%MYLIB_ROOT%\bin;%PATH%$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(MYLIB_ROOT)\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(MYLIB_ROOT)\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>mylib.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
I get the idea of using LocalDebuggerEnvironment
from manually setting the PATH environment variable in the project's properties:
This change was reflected in the *.vcxproj.user
project option file, which I then replicated in my own property sheet.
HTH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With