diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 82d55883c8..76df602f7f 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -284,6 +284,7 @@ Properties on Targets
/prop_tgt/VS_SCC_PROJECTNAME
/prop_tgt/VS_SCC_PROVIDER
/prop_tgt/VS_SDK_REFERENCES
+ /prop_tgt/VS_USER_PROPS_CXX
/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
/prop_tgt/VS_WINRT_COMPONENT
/prop_tgt/VS_WINRT_EXTENSIONS
diff --git a/Help/prop_tgt/VS_USER_PROPS_CXX.rst b/Help/prop_tgt/VS_USER_PROPS_CXX.rst
new file mode 100644
index 0000000000..083ce03f5e
--- /dev/null
+++ b/Help/prop_tgt/VS_USER_PROPS_CXX.rst
@@ -0,0 +1,12 @@
+VS_USER_PROPS_CXX
+-----------------
+
+Sets the user props file to be included in the visual studio
+C++ project file. The standard path is
+``$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props``, which is
+in most cases the same as
+``%LOCALAPPDATA%\\Microsoft\\MSBuild\\v4.0\\Microsoft.Cpp.Win32.user.props``
+or ``%LOCALAPPDATA%\\Microsoft\\MSBuild\\v4.0\\Microsoft.Cpp.x64.user.props``.
+
+The ``*.user.props`` files can be used for Visual Studio wide
+configuration which is independent from cmake.
diff --git a/Help/release/dev/vs-custom-msbuild-props.rst b/Help/release/dev/vs-custom-msbuild-props.rst
new file mode 100644
index 0000000000..15a5b0af59
--- /dev/null
+++ b/Help/release/dev/vs-custom-msbuild-props.rst
@@ -0,0 +1,9 @@
+vs-custom-msbuild-props
+-----------------------
+
+* The :ref:`Visual Studio Generators` for VS 2010 and above can
+ now be fine tuned using custom msbuild .props files.
+ :prop_tgt:`VS_USER_PROPS_CXX` can be
+ used to change the default path of the user .props file from
+ ``$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props`` to
+ an arbitrary filename.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 4dabd51d90..5b990070ae 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -139,7 +139,11 @@ void cmVisualStudio10TargetGenerator::WriteString(const char* line,
(*this->BuildFileStream) << line;
}
-#define VS10_USER_PROPS "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props"
+#define VS10_CXX_DEFAULT_PROPS "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"
+#define VS10_CXX_PROPS "$(VCTargetsPath)\\Microsoft.Cpp.props"
+#define VS10_CXX_USER_PROPS \
+ "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props"
+#define VS10_CXX_TARGETS "$(VCTargetsPath)\\Microsoft.Cpp.targets"
void cmVisualStudio10TargetGenerator::Generate()
{
@@ -345,12 +349,9 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("\n", 1);
- this->WriteString("\n",
- 1);
+ this->WriteString("\n", 1);
this->WriteProjectConfigurationValues();
- this->WriteString(
- "\n", 1);
+ this->WriteString("\n", 1);
this->WriteString("\n", 1);
if (this->GlobalGenerator->IsMasmEnabled()) {
this->WriteString("WriteString("\n", 1);
this->WriteString("\n", 1);
- this->WriteString("\n",
- 2);
+ {
+ std::string props = VS10_CXX_USER_PROPS;
+ if (const char* p =
+ this->GeneratorTarget->GetProperty("VS_USER_PROPS_CXX")) {
+ props = p;
+ this->ConvertToWindowsSlash(props);
+ }
+ this->WriteString("", 2);
+ (*this->BuildFileStream)
+ << "\n";
+ }
this->WritePlatformExtensions();
this->WriteString("\n", 1);
this->WriteString("\n", 1);
@@ -377,10 +387,8 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteWinRTReferences();
this->WriteProjectReferences();
this->WriteSDKReferences();
- this->WriteString(
- "\n",
- 1);
+ this->WriteString("\n", 1);
+
this->WriteTargetSpecificReferences();
this->WriteString("\n", 1);
this->WriteTargetsFileReferences();
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 22d8164047..d913af7ecc 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
include(RunCMake)
run_cmake(VsConfigurationType)
run_cmake(VsTargetsFileReferences)
+run_cmake(VsCustomProps)
diff --git a/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake b/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
new file mode 100644
index 0000000000..22a3df0f0c
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
@@ -0,0 +1,25 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(importFound FALSE)
+
+set(props_file "${RunCMake_SOURCE_DIR}/my.props")
+file(TO_NATIVE_PATH "${props_file}" check_file)
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "^ *
+
+
+
+