mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-20 04:24:36 +08:00
VS: add test for VS_CSHARP_* source file property
This commit is contained in:

committed by
Brad King

parent
a202749c46
commit
506207f928
@@ -3,3 +3,4 @@ run_cmake(VsConfigurationType)
|
|||||||
run_cmake(VsTargetsFileReferences)
|
run_cmake(VsTargetsFileReferences)
|
||||||
run_cmake(VsCustomProps)
|
run_cmake(VsCustomProps)
|
||||||
run_cmake(VsDebuggerWorkingDir)
|
run_cmake(VsDebuggerWorkingDir)
|
||||||
|
run_cmake(VsCSharpCustomTags)
|
||||||
|
23
Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake
Normal file
23
Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake
Normal file
@@ -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()
|
11
Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake
Normal file
11
Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake
Normal file
@@ -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}")
|
3
Tests/RunCMake/VS10Project/foo.cs
Normal file
3
Tests/RunCMake/VS10Project/foo.cs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
void foo()
|
||||||
|
{
|
||||||
|
}
|
Reference in New Issue
Block a user