|
|
@@ -265,15 +265,19 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
|
|
|
}
|
|
|
|
|
|
if (!this->GeneratorTarget->Target->IsNormal()) {
|
|
|
- auto flag = this->GetMakefile()->GetSafeDefinition(
|
|
|
- "CMAKE_CXX_MODULE_BMI_ONLY_FLAG");
|
|
|
- cmRulePlaceholderExpander::RuleVariables compileObjectVars;
|
|
|
- compileObjectVars.Object = objectFileName.c_str();
|
|
|
- auto rulePlaceholderExpander =
|
|
|
- this->GetLocalGenerator()->CreateRulePlaceholderExpander();
|
|
|
- rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
|
|
|
- flag, compileObjectVars);
|
|
|
- this->LocalGenerator->AppendCompileOptions(flags, flag);
|
|
|
+ if (this->GetMakefile()
|
|
|
+ ->GetDefinition("CMAKE_CXX_COMPILE_BMI")
|
|
|
+ .IsEmpty()) {
|
|
|
+ auto flag = this->GetMakefile()->GetSafeDefinition(
|
|
|
+ "CMAKE_CXX_MODULE_BMI_ONLY_FLAG");
|
|
|
+ cmRulePlaceholderExpander::RuleVariables compileObjectVars;
|
|
|
+ compileObjectVars.Object = objectFileName.c_str();
|
|
|
+ auto rulePlaceholderExpander =
|
|
|
+ this->GetLocalGenerator()->CreateRulePlaceholderExpander();
|
|
|
+ rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
|
|
|
+ flag, compileObjectVars);
|
|
|
+ this->LocalGenerator->AppendCompileOptions(flags, flag);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -652,6 +656,19 @@ void cmNinjaTargetGenerator::WriteCompileRule(std::string const& lang,
|
|
|
this->WriteCompileRule(lang, config, WithScanning::No);
|
|
|
}
|
|
|
|
|
|
+std::string cmNinjaTargetGenerator::GetCompileTemplateVar(
|
|
|
+ std::string const& lang) const
|
|
|
+{
|
|
|
+ std::string cmdVar = cmStrCat("CMAKE_", lang, "_COMPILE_OBJECT");
|
|
|
+ if (!this->GetGeneratorTarget()->IsNormal()) {
|
|
|
+ std::string bmiCmdVar = cmStrCat("CMAKE_", lang, "_COMPILE_BMI");
|
|
|
+ if (!this->GetMakefile()->GetDefinition(bmiCmdVar).IsEmpty()) {
|
|
|
+ cmdVar = std::move(bmiCmdVar);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return cmdVar;
|
|
|
+}
|
|
|
+
|
|
|
void cmNinjaTargetGenerator::WriteCompileRule(std::string const& lang,
|
|
|
std::string const& config,
|
|
|
WithScanning withScanning)
|
|
|
@@ -928,7 +945,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(std::string const& lang,
|
|
|
}
|
|
|
|
|
|
// Rule for compiling object file.
|
|
|
- std::string const cmdVar = cmStrCat("CMAKE_", lang, "_COMPILE_OBJECT");
|
|
|
+ std::string const cmdVar = this->GetCompileTemplateVar(lang);
|
|
|
std::string const& compileCmd = mf->GetRequiredDefinition(cmdVar);
|
|
|
cmList compileCmds(compileCmd);
|
|
|
|
|
|
@@ -2313,7 +2330,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
|
|
|
compileObjectVars.CudaCompileMode = cudaCompileMode.c_str();
|
|
|
}
|
|
|
|
|
|
- std::string const cmdVar = cmStrCat("CMAKE_", language, "_COMPILE_OBJECT");
|
|
|
+ std::string const cmdVar = this->GetCompileTemplateVar(language);
|
|
|
std::string const& compileCmd =
|
|
|
this->Makefile->GetRequiredDefinition(cmdVar);
|
|
|
cmList compileCmds(compileCmd);
|