mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
VS: Factor out check for mixed C and C++ target
This commit is contained in:
@@ -3354,6 +3354,14 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
|
|||||||
this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
|
this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
|
||||||
langForClCompile, configName);
|
langForClCompile, configName);
|
||||||
}
|
}
|
||||||
|
bool const isCXXwithC = [this, &configName]() -> bool {
|
||||||
|
if (this->LangForClCompile != "CXX"_s) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::set<std::string> languages;
|
||||||
|
this->GeneratorTarget->GetLanguages(languages, configName);
|
||||||
|
return languages.find("C") != languages.end();
|
||||||
|
}();
|
||||||
|
|
||||||
// Put the IPO enabled configurations into a set.
|
// Put the IPO enabled configurations into a set.
|
||||||
if (this->GeneratorTarget->IsIPOEnabled(linkLanguage, configName)) {
|
if (this->GeneratorTarget->IsIPOEnabled(linkLanguage, configName)) {
|
||||||
@@ -3504,21 +3512,17 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add C-specific flags expressible in a ClCompile meant for C++.
|
// Add C-specific flags expressible in a ClCompile meant for C++.
|
||||||
if (langForClCompile == "CXX"_s) {
|
if (isCXXwithC) {
|
||||||
std::set<std::string> languages;
|
std::string flagsC;
|
||||||
this->GeneratorTarget->GetLanguages(languages, configName);
|
this->LocalGenerator->AddLanguageFlags(
|
||||||
if (languages.count("C")) {
|
flagsC, this->GeneratorTarget, cmBuildStep::Compile, "C", configName);
|
||||||
std::string flagsC;
|
this->LocalGenerator->AddCompileOptions(flagsC, this->GeneratorTarget, "C",
|
||||||
this->LocalGenerator->AddLanguageFlags(
|
configName);
|
||||||
flagsC, this->GeneratorTarget, cmBuildStep::Compile, "C", configName);
|
Options optC(this->LocalGenerator, Options::Compiler,
|
||||||
this->LocalGenerator->AddCompileOptions(flagsC, this->GeneratorTarget,
|
gg->GetClFlagTable());
|
||||||
"C", configName);
|
optC.Parse(flagsC);
|
||||||
Options optC(this->LocalGenerator, Options::Compiler,
|
if (const char* stdC = optC.GetFlag("LanguageStandard_C")) {
|
||||||
gg->GetClFlagTable());
|
clOptions.AddFlag("LanguageStandard_C", stdC);
|
||||||
optC.Parse(flagsC);
|
|
||||||
if (const char* stdC = optC.GetFlag("LanguageStandard_C")) {
|
|
||||||
clOptions.AddFlag("LanguageStandard_C", stdC);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user