Reputation: 3383
I am working on a project using Visual Studio 2013 on Windows 10. Basically I am writing a few MEX files using C++, and I'm using a few libraries that I use often: OpenCV and MATLAB's extern libraries. For each library, I have saved property sheets (.props files) with all of the necessary information. The gist of it is that I am trying to add both my opencv.props file and my matlab.props file to the project.
My current problem arises when I try to add multiple property sheets to the property configuration in "Property Manager." For each, I click "Add existing property sheet" and voila! I am supposed to get the proper settings. When I only use a single property sheet, everything works fine. When I try adding multiple sheets, only the most recent addition seems to be registering.
Any idea where I'm going wrong?
I've pasted the contents of the .props files below since they're both pretty short and simple:
matlab.props
<?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 />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(MATLAB_DIR)\extern\include</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
opencv.props
<?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>
<_PropertySheetDisplayName>OpenCV_debug</_PropertySheetDisplayName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(OPENCV_DIR)\..\..\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(OPENCV_DIR)\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>opencv_calib3d$(OPENCV_VERSION)d.lib;opencv_contrib$(OPENCV_VERSION)d.lib;opencv_core$(OPENCV_VERSION)d.lib;opencv_features2d$(OPENCV_VERSION)d.lib;opencv_flann$(OPENCV_VERSION)d.lib;opencv_gpu$(OPENCV_VERSION)d.lib;opencv_highgui$(OPENCV_VERSION)d.lib;opencv_imgproc$(OPENCV_VERSION)d.lib;opencv_legacy$(OPENCV_VERSION)d.lib;opencv_ml$(OPENCV_VERSION)d.lib;opencv_nonfree$(OPENCV_VERSION)d.lib;opencv_objdetect$(OPENCV_VERSION)d.lib;opencv_ocl$(OPENCV_VERSION)d.lib;opencv_photo$(OPENCV_VERSION)d.lib;opencv_stitching$(OPENCV_VERSION)d.lib;opencv_superres$(OPENCV_VERSION)d.lib;opencv_ts$(OPENCV_VERSION)d.lib;opencv_video$(OPENCV_VERSION)d.lib;opencv_videostab$(OPENCV_VERSION)d.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
Upvotes: 2
Views: 474
Reputation: 51414
In general, properties in a property sheet overwrite previously set properties. To retain previous settings, you have to add them explicitly (using the %(<prop>) macro syntax).
For example, in your opencv.props file you need to replace
<AdditionalIncludeDirectories>$(MATLAB_DIR)\extern\include</AdditionalIncludeDirectories>
with
<AdditionalIncludeDirectories>$(MATLAB_DIR)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Apply the same changes to the <AdditionalLibraryDirectories>
property; the <AdditionalDependencies>
is already correct.
Upvotes: 2