Commit 3e86fc40 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'vs-csharp-link'

31bbcd19

 VS: Fix CSharp sources inside build directory
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !6065
parents 79427dcc 31bbcd19
......@@ -5037,7 +5037,9 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
{
// For out of source files, we first check if a matching source group
// for this file exists, otherwise we check if the path relative to current
// source- or binary-dir is used within the link and return that
// source- or binary-dir is used within the link and return that.
// In case of .cs files we can't do that automatically for files in the
// binary directory, because this leads to compilation errors.
std::string link;
std::string sourceGroupedFile;
std::string const& fullFileName = source->GetFullPath();
......@@ -5059,7 +5061,8 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
link = sourceGroupedFile;
} else if (cmHasPrefix(fullFileName, srcDir)) {
link = fullFileName.substr(srcDir.length() + 1);
} else if (cmHasPrefix(fullFileName, binDir)) {
} else if (!cmHasSuffix(fullFileName, ".cs") &&
cmHasPrefix(fullFileName, binDir)) {
link = fullFileName.substr(binDir.length() + 1);
} else if (cmProp l = source->GetProperty("VS_CSHARP_Link")) {
link = *l;
......
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
//General Information about an assembly is controlled through the following
//set of attributes. Change these attribute values to modify the information
//associated with an assembly.
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
......@@ -13,6 +13,7 @@ set(SOURCE_GROUPS_TO_FIND
"CSharpSourceGroup\\\\nested\\\\baz\\.cs"
"CSharpSourceGroup\\\\images\\\\empty\\.bmp"
"VsCsharpSourceGroup\\.png"
"AssemblyInfo\\.cs"
)
foreach(GROUP_NAME IN LISTS SOURCE_GROUPS_TO_FIND)
......
......@@ -20,3 +20,11 @@ add_library(VsCsharpSourceGroup SHARED ${SRC_FILES} ${IMAGE_FILES} ${RESOURCE_FI
source_group("CSharpSourceGroup" FILES ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/foo.cs)
source_group("CSharpSourceGroup/nested" FILES ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/nested/baz.cs)
source_group("Images" FILES ${IMAGE_FILES})
# Test covering CMake Issue 22104.
# Basically there should not be any link tags for files in the binary directory.
include(CSharpUtilities)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/cmake/AssemblyInfo.cs.in" "Properties/AssemblyInfo.cs")
target_sources(VsCsharpSourceGroup PRIVATE "Properties/AssemblyInfo.cs")
csharp_set_designer_cs_properties("Properties/AssemblyInfo.cs")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment