summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkStartupObject-check.cmake
diff options
context:
space:
mode:
authorFlorian Schweiger <husker@dzdm.de>2022-04-08 11:01:57 (GMT)
committerFlorian Schweiger <husker@dzdm.de>2022-04-12 13:35:17 (GMT)
commitd89af11f89fe1a76e3c48e3320a541c58b794c72 (patch)
tree30f41de30f97d4ca3c3a5bbb51bf5fe8a54e1e63 /Tests/RunCMake/VsDotnetSdk/VsDotnetSdkStartupObject-check.cmake
parent359d7c19e522465b7ceadcfc69a25ffc799d344f (diff)
downloadCMake-d89af11f89fe1a76e3c48e3320a541c58b794c72.zip
CMake-d89af11f89fe1a76e3c48e3320a541c58b794c72.tar.gz
CMake-d89af11f89fe1a76e3c48e3320a541c58b794c72.tar.bz2
VS: Add StartupObject property for managed .NET projects
Diffstat (limited to 'Tests/RunCMake/VsDotnetSdk/VsDotnetSdkStartupObject-check.cmake')
-rw-r--r--Tests/RunCMake/VsDotnetSdk/VsDotnetSdkStartupObject-check.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkStartupObject-check.cmake b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkStartupObject-check.cmake
new file mode 100644
index 0000000..e81de30
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkStartupObject-check.cmake
@@ -0,0 +1,22 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(startupObjectSet FALSE)
+
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<StartupObject[^>]*>([^<>]+)</StartupObject>$")
+ if("${CMAKE_MATCH_1}" STREQUAL "CSharpOnly.CSharpOnly")
+ message(STATUS "foo.csproj has StartupObject class set")
+ set(startupObjectSet TRUE)
+ endif()
+ endif()
+endforeach()
+
+if(NOT startupObjectSet)
+ set(RunCMake_TEST_FAILED "StartupObject not found or not set correctly.")
+ return()
+endif()