I develop native C++ style apps that are usually tested as console apps. I mainly work in VS 2010 and 2012. I use a variety of libraries - for example boost. I have many many moderate size projects with differing dependencies on these libraries. Having been forced to use props files when I transferred from 2008 to 2010 I came to realise props files are extraordinarily useful in managing this context, particularly in a situation where version control and heterogenous setups are the norm (an academic environment).
But I have hit a problem. It revolves around setting the path used when running the compiled programme from the IDE so that it finds dlls associated with the different libraries. Some people suggest copying the relevant files to the target Directory but this is not practical and it is usually much easier to modify the path in $(LocalDebuggerEnvironment) to include the relevant folders.
If I want to use boost, I set one global environement variable pointing to the fully installed version of boost I want to use on the build platform: eg
setx /m BOOST_ROOT "R:\sdks\boost\boost_1_52_0"
add a copy of a props file such as boost.props below as an item into to the project (to make sure version control sees it), and then add it to the project I want to use boost in using the property manager window. All great - my programs compile and run in the ide and find the relevant dlls - copying dlls is quite impractical for such a large library as boost.
THE PROBLEM
This method works excellently for several libraries at once - simply add the relevant props files to the project and the projects find all the includes etc and build perfectly. However, try as I can, I do not seem to find a way to cascade the $(LocalDebuggerEnvironment) variables in such a way that the paths to the dlls cascade - I always seem to get the last one.
PLEASE HELP
My boost props file (Note the single line break in the middle of the redefinition of LocalDebuggerEnvironment is essential and reflects that this is a list) one sometimes writes
...;%PATH% $(LocalDebuggerEnvironment)... instead
<?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">
<BOOST_BIN>$(BOOST_ROOT)\$(Platform)\lib</BOOST_BIN>
<BOOST_LIB>$(BOOST_BIN)</BOOST_LIB>
<BOOST_INC>$(BOOST_ROOT)</BOOST_INC>
<BOOST_EXE>$(LocalDebuggerCommand)</BOOST_EXE>
<BOOST_OPT>$(LocalDebuggerArguments)</BOOST_OPT>
<LocalDebuggerEnvironment>PATH=$(BOOST_BIN);%PATH%
$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
<LocalDebuggerCommand>$(BOOST_EXE)</LocalDebuggerCommand>
<LocalDebuggerArguments>$(BOOST_OPT)</LocalDebuggerArguments>
</PropertyGroup>
<PropertyGroup>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup>
<LibraryPath>$(BOOST_LIB);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup>
<IncludePath>$(BOOST_INC);$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup>
<SourcePath>$(BOOST_INC);$(SourcePath)</SourcePath>
</PropertyGroup>
<ItemDefinitionGroup>
</ItemDefinitionGroup>
<ItemGroup>
<BuildMacro Include="BOOST_LIB">
<Value>$(BOOST_LIB)</Value>
</BuildMacro>
<BuildMacro Include="BOOST_INC">
<Value>$(BOOST_INC)</Value>
</BuildMacro>
<BuildMacro Include="BOOST_BIN">
<Value>$(BOOST_BIN)</Value>
</BuildMacro>
<BuildMacro Include="BOOST_EXE">
<Value>$(BOOST_EXE)</Value>
</BuildMacro>
<BuildMacro Include="BOOST_OPT">
<Value>$(BOOST_OPT)</Value>
</BuildMacro>
<BuildMacro Include="LocalDebuggerEnvironment">
<Value>$(LocalDebuggerEnvironment)</Value>
</BuildMacro>
<BuildMacro Include="LocalDebuggerCommand">
<Value>$(LocalDebuggerCommand)</Value>
</BuildMacro>
<BuildMacro Include="LocalDebuggerArguments">
<Value>$(LocalDebuggerArguments)</Value>
</BuildMacro>
</ItemGroup>
</Project>