summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorSumit Bhardwaj <bhardwajs@outlook.com>2022-07-16 06:52:27 (GMT)
committerBrad King <brad.king@kitware.com>2022-07-20 12:51:38 (GMT)
commit7219988b006eb0b2fd52ab0ab3a38178a2e14c80 (patch)
tree089bf877f4ec1a096f8e9d1c204c80270ee4f3d8 /Tests
parent9d9c09b3df784b9ea8dd1f576bfb379bc3772391 (diff)
downloadCMake-7219988b006eb0b2fd52ab0ab3a38178a2e14c80.zip
CMake-7219988b006eb0b2fd52ab0ab3a38178a2e14c80.tar.gz
CMake-7219988b006eb0b2fd52ab0ab3a38178a2e14c80.tar.bz2
VS: Exclude ZERO_CHECK.proj from .sln for include_external_msproject
In `cmGlobalVisualStudio7Generator::WriteTargetsToSolution`, we skip writing `ZERO_CHECK.proj` to solution file as the check in `cmGlobalVisualStudioGenerator::IsInSolution` returns `false` for `ZERO_CHECK`. However, we write ZERO_CHECK to ProjectDependencies for external projects as there are no checks in `cmGlobalVisualStudio71Generator::WriteExternalProject`. Similar to `cmGlobalVisualStudioGenerator::IsInSolution`, we introduce `IsDepInSolution(const std::string&)` which excludes `ZERO_CHECK.proj` from being added to sln file for the cases where we have `ZERO_CHECK.proj`. Fixes: #23708
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/include_external_msproject/Program.cs9
-rw-r--r--Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/include_external_msproject/VSCSharpOnlyProject.cmake9
-rw-r--r--Tests/RunCMake/include_external_msproject/consoleapp.csproj14
4 files changed, 43 insertions, 0 deletions
diff --git a/Tests/RunCMake/include_external_msproject/Program.cs b/Tests/RunCMake/include_external_msproject/Program.cs
new file mode 100644
index 0000000..5ed58c8
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/Program.cs
@@ -0,0 +1,9 @@
+namespace ConsoleApp
+{
+ internal class Program
+ {
+ static void Main(string[] args)
+ {
+ }
+ }
+}
diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
index cb0eb18..4fbf147 100644
--- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
@@ -10,3 +10,14 @@ if(RunCMake_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])")
run_cmake(SkipGetTargetFrameworkProperties)
run_cmake(VSCSharpReference)
endif()
+
+if(RunCMake_GENERATOR MATCHES "^Visual Studio (1[6-9]|[2-9][0-9])")
+ function(run_VSCSharpOnlyProject)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VSCSharpOnlyProject-build)
+ run_cmake(VSCSharpOnlyProject)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(build_flags /restore)
+ run_cmake_command(VSCSharpOnlyProject-build ${CMAKE_COMMAND} --build . -- ${build_flags})
+ endfunction()
+ run_VSCSharpOnlyProject()
+endif()
diff --git a/Tests/RunCMake/include_external_msproject/VSCSharpOnlyProject.cmake b/Tests/RunCMake/include_external_msproject/VSCSharpOnlyProject.cmake
new file mode 100644
index 0000000..e7e0b99
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/VSCSharpOnlyProject.cmake
@@ -0,0 +1,9 @@
+project(VSCSharpOnlyProject)
+
+file(COPY
+ ${CMAKE_CURRENT_SOURCE_DIR}/Program.cs
+ ${CMAKE_CURRENT_SOURCE_DIR}/consoleapp.csproj
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+
+include_external_msproject(
+ test "${CMAKE_CURRENT_BINARY_DIR}/consoleapp.csproj")
diff --git a/Tests/RunCMake/include_external_msproject/consoleapp.csproj b/Tests/RunCMake/include_external_msproject/consoleapp.csproj
new file mode 100644
index 0000000..2894848
--- /dev/null
+++ b/Tests/RunCMake/include_external_msproject/consoleapp.csproj
@@ -0,0 +1,14 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net472</TargetFramework>
+ <RootNamespace>ConsoleApp</RootNamespace>
+ <AssemblyName>ConsoleApp</AssemblyName>
+ <PlatformTarget>x64</PlatformTarget>
+ <EnableDefaultItems>false</EnableDefaultItems>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ </ItemGroup>
+</Project>