summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auxiliary/vim/syntax/cmake.vim1
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/prop_tgt/VS_FILTER_PROPS.rst10
-rw-r--r--Help/release/dev/vs-filter-props.rst6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx12
-rw-r--r--Tests/RunCMake/VS10Project/VsCustomProps-check.cmake45
-rw-r--r--Tests/RunCMake/VS10Project/VsCustomProps.cmake3
7 files changed, 57 insertions, 21 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 5629356..5d412c2 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -450,6 +450,7 @@ syn keyword cmakeProperty contained
\ VS_STARTUP_PROJECT
\ VS_TOOL_OVERRIDE
\ VS_USER_PROPS
+ \ VS_FILTER_PROPS
\ VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
\ VS_WINRT_COMPONENT
\ VS_WINRT_EXTENSIONS
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 6ccc23e..7e640df 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -448,6 +448,7 @@ Properties on Targets
/prop_tgt/VS_SOURCE_SETTINGS_tool
/prop_tgt/VS_USE_DEBUG_LIBRARIES
/prop_tgt/VS_USER_PROPS
+ /prop_tgt/VS_FILTER_PROPS
/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
/prop_tgt/VS_WINRT_COMPONENT
/prop_tgt/VS_WINRT_REFERENCES
diff --git a/Help/prop_tgt/VS_FILTER_PROPS.rst b/Help/prop_tgt/VS_FILTER_PROPS.rst
new file mode 100644
index 0000000..3de0a16
--- /dev/null
+++ b/Help/prop_tgt/VS_FILTER_PROPS.rst
@@ -0,0 +1,10 @@
+VS_FILTER_PROPS
+---------------
+
+.. versionadded:: 3.30
+
+Sets the filter props file to be included in the visual studio
+C++ project filter file.
+
+The ``*.filter.props`` files can be used for Visual Studio wide
+configuration which is independent from cmake.
diff --git a/Help/release/dev/vs-filter-props.rst b/Help/release/dev/vs-filter-props.rst
new file mode 100644
index 0000000..5a09511
--- /dev/null
+++ b/Help/release/dev/vs-filter-props.rst
@@ -0,0 +1,6 @@
+vs-filter-props
+---------------
+
+* A :prop_tgt:`VS_FILTER_PROPS` target property was added to tell
+ :ref:`Visual Studio Generators` for VS 2010 and above to use a
+ custom MSBuild filter ``.props`` file.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index bca4719..140a20b 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2074,6 +2074,18 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
"gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms");
}
}
+ {
+ if (cmValue p = this->GeneratorTarget->GetProperty("VS_FILTER_PROPS")) {
+ auto props = *p;
+ if (!props.empty()) {
+ ConvertToWindowsSlash(props);
+ Elem(e0, "Import")
+ .Attribute("Project", props)
+ .Attribute("Condition", cmStrCat("exists('", props, "')"))
+ .Attribute("Label", "LocalAppDataPlatform");
+ }
+ }
+ }
}
fout << '\n';
diff --git a/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake b/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
index 22a3df0..ad585d5 100644
--- a/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
+++ b/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
@@ -1,25 +1,30 @@
-set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
-if(NOT EXISTS "${vcProjectFile}")
- set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
- return()
-endif()
+macro(check_custom_prop suffix)
+ set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj${suffix}")
+ if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+ endif()
-set(importFound FALSE)
+ 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 "^ *<Import Project=\"([^\"]+)\".*Label=\"([^\"]+)\".*$")
- if("${CMAKE_MATCH_1}" STREQUAL "${check_file}" AND
- "${CMAKE_MATCH_2}" STREQUAL "LocalAppDataPlatform")
- message(STATUS "foo.vcxproj is importing ${check_file}")
- set(importFound TRUE)
+ 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 "^ *<Import Project=\"([^\"]+)\".*Label=\"([^\"]+)\".*$")
+ if("${CMAKE_MATCH_1}" STREQUAL "${check_file}" AND
+ "${CMAKE_MATCH_2}" STREQUAL "LocalAppDataPlatform")
+ message(STATUS "foo.vcxproj${suffix} is importing ${check_file}")
+ set(importFound TRUE)
+ endif()
endif()
+ endforeach()
+
+ if(NOT importFound)
+ set(RunCMake_TEST_FAILED "Import of custom .props file not found.")
+ return()
endif()
-endforeach()
+endmacro()
-if(NOT importFound)
- set(RunCMake_TEST_FAILED "Import of custom .props file not found.")
- return()
-endif()
+check_custom_prop("")
+check_custom_prop(".filters")
diff --git a/Tests/RunCMake/VS10Project/VsCustomProps.cmake b/Tests/RunCMake/VS10Project/VsCustomProps.cmake
index fbbcfcf..d6c905f 100644
--- a/Tests/RunCMake/VS10Project/VsCustomProps.cmake
+++ b/Tests/RunCMake/VS10Project/VsCustomProps.cmake
@@ -4,4 +4,5 @@ add_library(foo foo.cpp)
set(props_file "${CMAKE_CURRENT_SOURCE_DIR}/my.props")
set_target_properties(foo PROPERTIES
- VS_USER_PROPS "${props_file}")
+ VS_USER_PROPS "${props_file}"
+ VS_FILTER_PROPS "${props_file}")