summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-01-13 16:33:55 (GMT)
committerBrad King <brad.king@kitware.com>2020-01-24 14:11:05 (GMT)
commitae1e1909a13fa6e68c33fe92cc8f5c76c30df76f (patch)
tree20f52a77199a163a7e8f4fd6a786ba1b77ac22f9 /Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake
parent93d414861251cb6c88021756f53621160b98bf96 (diff)
downloadCMake-ae1e1909a13fa6e68c33fe92cc8f5c76c30df76f.zip
CMake-ae1e1909a13fa6e68c33fe92cc8f5c76c30df76f.tar.gz
CMake-ae1e1909a13fa6e68c33fe92cc8f5c76c30df76f.tar.bz2
VS: Add support for .NET Standard and .NET Core
Fixes: #20105
Diffstat (limited to 'Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake')
-rw-r--r--Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake40
1 files changed, 40 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake b/Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake
new file mode 100644
index 0000000..e656639
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake
@@ -0,0 +1,40 @@
+set(files foo.csproj bar.csproj)
+
+set(inLib1 FALSE)
+set(targetFrameworkInLib1 FALSE)
+
+set(inLib2 FALSE)
+set(targetFrameworksInLib2 FALSE)
+
+foreach(file ${files})
+ set(csProjectFile ${RunCMake_TEST_BINARY_DIR}/${file})
+
+ if(NOT EXISTS "${csProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.")
+ return()
+ endif()
+
+ file(STRINGS "${csProjectFile}" lines)
+
+ foreach(line IN LISTS lines)
+ if(NOT inLib1)
+ if(line MATCHES " *<TargetFramework>netcoreapp3.1</TargetFramework> *$")
+ set(targetFrameworkInLib1 TRUE)
+ set(inLib1 TRUE)
+ endif()
+ elseif(NOT inLib2)
+ if(line MATCHES " *<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks> *$")
+ set(targetFrameworksInLib2 TRUE)
+ set(inLib2 TRUE)
+ endif()
+ endif()
+ endforeach()
+endforeach()
+
+if(NOT targetFrameworkInLib1)
+ set(RunCMake_TEST_FAILED "TargetFramework not set correctly.")
+endif()
+
+if(NOT targetFrameworksInLib2)
+ set(RunCMake_TEST_FAILED "TargetFrameworks not set correctly.")
+endif()