summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
diff options
context:
space:
mode:
authorMichael Stürmer <michael.stuermer@schaeffler.com>2016-11-21 15:05:17 (GMT)
committerBrad King <brad.king@kitware.com>2016-11-29 14:31:30 (GMT)
commite390991846825799e619e072a28f1da58b7c89ba (patch)
treec311f84f4df2a5e55cf667fe505e243de45c9258 /Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
parent1528831bb1330cc539004f9fb3068e871f109d34 (diff)
downloadCMake-e390991846825799e619e072a28f1da58b7c89ba.zip
CMake-e390991846825799e619e072a28f1da58b7c89ba.tar.gz
CMake-e390991846825799e619e072a28f1da58b7c89ba.tar.bz2
VS: Add option to customize vcxproj user props file
Add a `VS_USER_PROPS_CXX` target property to set the user props file of the generated `.vcxproj` file to be something other than the default `$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props`.
Diffstat (limited to 'Tests/RunCMake/VS10Project/VsCustomProps-check.cmake')
-rw-r--r--Tests/RunCMake/VS10Project/VsCustomProps-check.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake b/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
new file mode 100644
index 0000000..22a3df0
--- /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 "^ *<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)
+ endif()
+ endif()
+endforeach()
+
+if(NOT importFound)
+ set(RunCMake_TEST_FAILED "Import of custom .props file not found.")
+ return()
+endif()