diff options
author | Michael Stürmer <michael.stuermer@schaeffler.com> | 2017-04-07 14:26:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-06-13 14:46:31 (GMT) |
commit | 07ec212ae8d55cd20c315a8e73bd358762f3f959 (patch) | |
tree | d47f6899f2af29ceba31cd2cbb12ef67ecd25012 /Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake | |
parent | 4ba2d2e3d76cb1ec04c612f9646c47d3f1231ad2 (diff) | |
download | CMake-07ec212ae8d55cd20c315a8e73bd358762f3f959.zip CMake-07ec212ae8d55cd20c315a8e73bd358762f3f959.tar.gz CMake-07ec212ae8d55cd20c315a8e73bd358762f3f959.tar.bz2 |
VS: add target property VS_DOTNET_REFERENCEPROP_<refname>_TAG_<tagname>
Fixes: #16689
Diffstat (limited to 'Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake')
-rw-r--r-- | Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake new file mode 100644 index 0000000..8b9bb67 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake @@ -0,0 +1,49 @@ +set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj") +if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() +endif() + +set(test1Reference "System") +set(test1Tag "Hello") +set(test1Value "World") + +set(test2Reference "foo2") +set(test2Tag "Hallo") +set(test2Value "Welt") + +set(tag1Found FALSE) +set(ref1Found FALSE) + +file(STRINGS "${csProjectFile}" lines) + +foreach(i 1 2) + set(testReference "${test${i}Reference}") + set(testTag "${test${i}Tag}") + set(testValue "${test${i}Value}") + foreach(line IN LISTS lines) + if(line MATCHES "^ *<(Project|)Reference .*>$") + set(validTag FALSE) + if(line MATCHES "^ *<(Project|)Reference .*\".*${testReference}.*\".*>$") + set(validTag TRUE) + message(STATUS "foo.csproj is using reference ${testReference}") + set(ref${i}Found TRUE) + endif() + endif() + if(line MATCHES "^ *<${testTag}>${testValue}</${testTag}>$") + if(validTag) + message(STATUS "foo.csproj reference ${testReference} has tag ${testTag}") + set(tag${i}Found TRUE) + else() + message(STATUS "tag ${testTag} found in wrong place!") + set(tag${i}Found FALSE) + endif() + endif() + endforeach() +endforeach() + +if(NOT tag1Found OR NOT ref1Found OR + NOT tag2Found OR NOT ref2Found) + set(RunCMake_TEST_FAILED "Custom reference XML tag not found.") + return() +endif() |