diff options
author | Michael Stürmer <michael.stuermer@schaeffler.com> | 2017-02-24 08:28:13 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-03-01 20:31:05 (GMT) |
commit | 506207f928bfc8853864edb9a200a38e7ac2b02b (patch) | |
tree | 3e8e241cc04ac9ad9dd7595423a0d97d5689f86f /Tests/RunCMake/VS10Project | |
parent | a202749c46f84563a6cccf6d5d31808fddf53408 (diff) | |
download | CMake-506207f928bfc8853864edb9a200a38e7ac2b02b.zip CMake-506207f928bfc8853864edb9a200a38e7ac2b02b.tar.gz CMake-506207f928bfc8853864edb9a200a38e7ac2b02b.tar.bz2 |
VS: add test for VS_CSHARP_* source file property
Diffstat (limited to 'Tests/RunCMake/VS10Project')
-rw-r--r-- | Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake | 23 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/foo.cs | 3 |
4 files changed, 38 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index bc1ec97..3af877f 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -3,3 +3,4 @@ run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) run_cmake(VsDebuggerWorkingDir) +run_cmake(VsCSharpCustomTags) diff --git a/Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake new file mode 100644 index 0000000..70ea193 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake @@ -0,0 +1,23 @@ +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(tagFound FALSE) + +set(tagName "MyCustomTag") +set(tagValue "MyCustomValue") + +file(STRINGS "${csProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<${tagName}>${tagValue}</${tagName}>") + message(STATUS "foo.csproj has tag ${tagName} with value ${tagValue} defined") + set(tagFound TRUE) + endif() +endforeach() + +if(NOT tagFound) + set(RunCMake_TEST_FAILED "Source file tag ${tagName} with value ${tagValue} not found.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake b/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake new file mode 100644 index 0000000..c51e9c3 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake @@ -0,0 +1,11 @@ +enable_language(CSharp) +add_library(foo foo.cs) + +set(props_file "${CMAKE_CURRENT_SOURCE_DIR}/my.props") + +set(tagName "MyCustomTag") +set(tagValue "MyCustomValue") + +set_source_files_properties(foo.cs + PROPERTIES + VS_CSHARP_${tagName} "${tagValue}") diff --git a/Tests/RunCMake/VS10Project/foo.cs b/Tests/RunCMake/VS10Project/foo.cs new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10Project/foo.cs @@ -0,0 +1,3 @@ +void foo() +{ +} |