diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalVisualStudio71Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 25 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 24 |
4 files changed, 14 insertions, 40 deletions
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 45cc583..0b086b0 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -98,7 +98,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, ext = ".vfproj"; project = "Project(\"{6989167D-11E4-40FE-8C1A-2192A86A7E90}\") = \""; } - if (this->TargetIsCSharpOnly(t)) { + if (t->HasLanguage("CSharp", "")) { ext = ".csproj"; project = "Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \""; } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index fa7dc51..a0e5d06 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -734,33 +734,10 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly( return false; } -bool cmGlobalVisualStudioGenerator::TargetIsCSharpOnly( - cmGeneratorTarget const* gt) -{ - // C# targets can be defined with add_library() (using SHARED or STATIC) and - // also using add_executable(). We do not treat imported C# targets the same - // (these come in as UTILITY) - if (gt->GetType() != cmStateEnums::SHARED_LIBRARY && - gt->GetType() != cmStateEnums::STATIC_LIBRARY && - gt->GetType() != cmStateEnums::EXECUTABLE) { - return false; - } - - // Issue diagnostic if the source files depend on the config. - std::vector<cmSourceFile*> sources; - if (!gt->GetConfigCommonSourceFiles(sources)) { - return false; - } - - std::set<std::string> languages; - gt->GetLanguages(languages, ""); - return languages.size() == 1 && languages.count("CSharp") > 0; -} - bool cmGlobalVisualStudioGenerator::TargetCanBeReferenced( cmGeneratorTarget const* gt) { - if (this->TargetIsCSharpOnly(gt)) { + if (gt->GetManagedType("") != cmGeneratorTarget::ManagedType::Native) { return true; } if (gt->GetType() != cmStateEnums::SHARED_LIBRARY && diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index f39dcca..da1f9a4 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -81,9 +81,6 @@ public: // return true if target is fortran only bool TargetIsFortranOnly(const cmGeneratorTarget* gt); - // return true if target is C# only - static bool TargetIsCSharpOnly(cmGeneratorTarget const* gt); - // return true if target can be referenced by C# targets bool TargetCanBeReferenced(cmGeneratorTarget const* gt); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b56104e..f52e79a 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -188,9 +188,7 @@ static std::string computeProjectFileExtension(cmGeneratorTarget const* t, { std::string res; res = ".vcxproj"; - std::string lang = t->GetLinkerLanguage(config); - if (cmGlobalVisualStudioGenerator::TargetIsCSharpOnly(t) || - lang == "CSharp") { + if (t->HasLanguage("CSharp", config)) { res = ".csproj"; } return res; @@ -3483,15 +3481,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.Target) { + auto managedType = l.Target->GetManagedType(""); + // 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 (managedType == cmGeneratorTarget::ManagedType::Managed) { + continue; + } } if (l.IsPath) { |