diff options
author | Brad King <brad.king@kitware.com> | 2018-10-02 18:58:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-02 18:58:57 (GMT) |
commit | 7787fb6e3e03806c861eadf930a1dace2ee248dd (patch) | |
tree | bb5181504b0df9a29b8a1917f902b8162600163c /Source | |
parent | 518c5060a73e01bae486ff386913aed1588a312d (diff) | |
parent | 375b420fdfe4eb34e92b98bb648ba37de3691c2e (diff) | |
download | CMake-7787fb6e3e03806c861eadf930a1dace2ee248dd.zip CMake-7787fb6e3e03806c861eadf930a1dace2ee248dd.tar.gz CMake-7787fb6e3e03806c861eadf930a1dace2ee248dd.tar.bz2 |
Merge branch 'fix-csharp-target-type' into release-3.12
Merge-request: !2427
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 8 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 8 |
3 files changed, 12 insertions, 6 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b223c5e..8aab1be 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5227,10 +5227,14 @@ bool cmGeneratorTarget::HasLanguage(std::string const& language, { std::set<std::string> languages; this->GetLanguages(languages, config); + // The "exclusive" check applies only to source files and not + // the linker language which may be affected by dependencies. + if (exclusive && languages.size() > 1) { + return false; + } // add linker language (if it is different from compiler languages) languages.insert(this->GetLinkerLanguage(config)); - return (languages.size() == 1 || !exclusive) && - languages.count(language) > 0; + return languages.count(language) > 0; } void cmGeneratorTarget::ComputeLinkImplementationLanguages( diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2132b15..2810887 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -366,7 +366,7 @@ public: // Evaluate if the target uses the given language for compilation // and/or linking. If 'exclusive' is true, 'language' is expected - // to be the only language used for the target. + // to be the only language used in source files for the target. bool HasLanguage(std::string const& language, std::string const& config, bool exclusive = true) const; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f472d8a..b8b04ae 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2413,10 +2413,12 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } // Choose a language whose flags to use for ClCompile. - static const char* clLangs[] = { "CXX", "C", "Fortran", "CSharp" }; + static const char* clLangs[] = { "CXX", "C", "Fortran" }; std::string langForClCompile; - if (std::find(cm::cbegin(clLangs), cm::cend(clLangs), linkLanguage) != - cm::cend(clLangs)) { + if (this->ProjectType == csproj) { + langForClCompile = "CSharp"; + } else if (std::find(cm::cbegin(clLangs), cm::cend(clLangs), linkLanguage) != + cm::cend(clLangs)) { langForClCompile = linkLanguage; } else { std::set<std::string> languages; |