summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorRobert Dailey <rcdailey@gmail.com>2018-02-05 21:43:25 (GMT)
committerRobert Dailey <rcdailey@gmail.com>2018-02-23 14:53:17 (GMT)
commit076a356cd1972a149898fdba77d1dd83981447b4 (patch)
treeb0ea4574fba9ccb786b699973f94e611f2f70fd3 /Source/cmVisualStudio10TargetGenerator.cxx
parentebf0a0827992be5cc03e530f9dc06bd1d05c1aa6 (diff)
downloadCMake-076a356cd1972a149898fdba77d1dd83981447b4.zip
CMake-076a356cd1972a149898fdba77d1dd83981447b4.tar.gz
CMake-076a356cd1972a149898fdba77d1dd83981447b4.tar.bz2
VS: Support C# project references
When specifying a pure C# target in the `target_link_libraries()` call to another C++ target, a `<ProjectReference>` was setup for it (we wanted this) but also a corresponding `.lib` was added under `<AdditionalDependencies>` (we didn't want this). This change introduces a check that prevents `.lib` linker options from being used when the corresponding target for that library is a C# target. Fixes: #17678
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 92d67db..48a5c0a 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3451,6 +3451,17 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
std::string currentBinDir =
this->LocalGenerator->GetCurrentBinaryDirectory();
for (cmComputeLinkInformation::Item const& l : libs) {
+ // Do not allow C# targets to be added to the LIB listing. LIB files are
+ // used for linking C++ dependencies. C# libraries do not have lib files.
+ // Instead, they compile down to C# reference libraries (DLL files). The
+ // `<ProjectReference>` elements added to the vcxproj are enough for the
+ // IDE to deduce the DLL file required by other C# projects that need its
+ // reference library.
+ if (l.Target &&
+ cmGlobalVisualStudioGenerator::TargetIsCSharpOnly(l.Target)) {
+ continue;
+ }
+
if (l.IsPath) {
std::string path =
this->LocalGenerator->ConvertToRelativePath(currentBinDir, l.Value);