summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorDario Passet <dario.passet@txtgroup.com>2021-05-13 18:38:01 +0200
committerDario Passet <dario.passet@txtgroup.com>2021-05-13 18:38:01 +0200
commitc7aa3bdefc05848666578802da2423efa4f24e26 (patch)
treea8d8b1138581a5f41fb5edd1433e86ab664469ef /Tests
parent65b58b0316598d03c6865a11203c3ac5b8ba36a4 (diff)
downloadcmake-c7aa3bdefc05848666578802da2423efa4f24e26.tar.gz
Tests/include_external_msproject: Check C# project reference
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/include_external_msproject/VSCSharpReference-check.cmake36
-rw-r--r--Tests/RunCMake/include_external_msproject/VSCSharpReference.cmake10
3 files changed, 47 insertions, 0 deletions
diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
index 7ed0773f9f..cb0eb18799 100644
--- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
@@ -8,4 +8,5 @@ run_cmake(CustomConfig)
if(RunCMake_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])")
run_cmake(SkipGetTargetFrameworkProperties)
+ run_cmake(VSCSharpReference)
endif()
diff --git a/Tests/RunCMake/include_external_msproject/VSCSharpReference-check.cmake b/Tests/RunCMake/include_external_msproject/VSCSharpReference-check.cmake
new file mode 100644
index 0000000000..71b8c1f9c6
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/VSCSharpReference-check.cmake
@@ -0,0 +1,36 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/internal.vcxproj" all_build)
+
+string(REGEX MATCH
+ "<ProjectReference.Include=.external.csproj.>.*</ProjectReference>"
+ ProjectReference
+ ${all_build}
+)
+
+if(ProjectReference STREQUAL "")
+ set(RunCMake_TEST_FAILED "${test} is being set unexpectedly.")
+else()
+ string(REGEX MATCH
+ "<ReferenceOutputAssembly>.*</ReferenceOutputAssembly>"
+ ReferenceOutputAssembly
+ ${ProjectReference}
+ )
+
+ if(NOT ReferenceOutputAssembly STREQUAL "")
+ string(REPLACE
+ "<ReferenceOutputAssembly>"
+ ""
+ ReferenceOutputAssemblyValue
+ ${ReferenceOutputAssembly}
+ )
+ string(REPLACE
+ "</ReferenceOutputAssembly>"
+ ""
+ ReferenceOutputAssemblyValue
+ ${ReferenceOutputAssemblyValue}
+ )
+
+ if(ReferenceOutputAssemblyValue MATCHES "[Fa][Ll][Ss][Ee]")
+ set(RunCMake_TEST_FAILED "Referenced C# project with ReferenceOutputAssembly set to false.")
+ endif()
+ endif()
+endif()
diff --git a/Tests/RunCMake/include_external_msproject/VSCSharpReference.cmake b/Tests/RunCMake/include_external_msproject/VSCSharpReference.cmake
new file mode 100644
index 0000000000..6229e612af
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/VSCSharpReference.cmake
@@ -0,0 +1,10 @@
+project(VSCSharpReference)
+
+include_external_msproject(external external.csproj)
+
+add_executable(internal
+ main.cpp
+)
+add_dependencies(internal
+ external
+)