summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/VS10Project
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/VS10Project
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/VS10Project')
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/VsDotnetStartupObject-check.cmake22
-rw-r--r--Tests/RunCMake/VS10Project/VsDotnetStartupObject.cmake10
3 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 273b9d5..ee8821a 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -83,6 +83,7 @@ else()
run_UnityBuildPCH()
endif()
+run_cmake(VsDotnetStartupObject)
run_cmake(VsDotnetTargetFramework)
run_cmake(VsDotnetTargetFrameworkVersion)
run_cmake(VsNoCompileBatching)
diff --git a/Tests/RunCMake/VS10Project/VsDotnetStartupObject-check.cmake b/Tests/RunCMake/VS10Project/VsDotnetStartupObject-check.cmake
new file mode 100644
index 0000000..b3e5e37
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDotnetStartupObject-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 "MyCompany.Package.MyStarterClass")
+ 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()
diff --git a/Tests/RunCMake/VS10Project/VsDotnetStartupObject.cmake b/Tests/RunCMake/VS10Project/VsDotnetStartupObject.cmake
new file mode 100644
index 0000000..8a0ec5e
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDotnetStartupObject.cmake
@@ -0,0 +1,10 @@
+enable_language(CSharp)
+if(NOT CMAKE_CSharp_COMPILER)
+ return()
+endif()
+
+set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "v4.6.1")
+
+add_executable(foo foo.cs)
+
+set_target_properties(foo PROPERTIES VS_DOTNET_STARTUP_OBJECT "MyCompany.Package.MyStarterClass")