mirror of
https://github.com/reactos/CMake.git
synced 2024-12-04 17:56:26 +00:00
cmLocalGenerator: Add AddCompileOptions overload with backtraces
This commit is contained in:
parent
5355a60fd0
commit
1f6a436bf4
@ -832,6 +832,16 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
|
|||||||
cmGeneratorTarget* target,
|
cmGeneratorTarget* target,
|
||||||
const std::string& lang,
|
const std::string& lang,
|
||||||
const std::string& config)
|
const std::string& config)
|
||||||
|
{
|
||||||
|
std::vector<BT<std::string>> tmpFlags;
|
||||||
|
this->AddCompileOptions(tmpFlags, target, lang, config);
|
||||||
|
this->AppendFlags(flags, tmpFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
|
||||||
|
cmGeneratorTarget* target,
|
||||||
|
const std::string& lang,
|
||||||
|
const std::string& config)
|
||||||
{
|
{
|
||||||
std::string langFlagRegexVar = std::string("CMAKE_") + lang + "_FLAG_REGEX";
|
std::string langFlagRegexVar = std::string("CMAKE_") + lang + "_FLAG_REGEX";
|
||||||
|
|
||||||
@ -843,20 +853,28 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
|
|||||||
cmSystemTools::ParseWindowsCommandLine(targetFlags, opts);
|
cmSystemTools::ParseWindowsCommandLine(targetFlags, opts);
|
||||||
// Re-escape these flags since COMPILE_FLAGS were already parsed
|
// Re-escape these flags since COMPILE_FLAGS were already parsed
|
||||||
// as a command line above.
|
// as a command line above.
|
||||||
this->AppendCompileOptions(flags, opts, langFlagRegexStr);
|
std::string compileOpts;
|
||||||
|
this->AppendCompileOptions(compileOpts, opts, langFlagRegexStr);
|
||||||
|
if (!compileOpts.empty()) {
|
||||||
|
flags.emplace_back(std::move(compileOpts));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
std::vector<std::string> targetCompileOpts;
|
std::vector<BT<std::string>> targetCompileOpts =
|
||||||
target->GetCompileOptions(targetCompileOpts, config, lang);
|
target->GetCompileOptions(config, lang);
|
||||||
// COMPILE_OPTIONS are escaped.
|
// COMPILE_OPTIONS are escaped.
|
||||||
this->AppendCompileOptions(flags, targetCompileOpts, langFlagRegexStr);
|
this->AppendCompileOptions(flags, targetCompileOpts, langFlagRegexStr);
|
||||||
} else {
|
} else {
|
||||||
// Use all flags.
|
// Use all flags.
|
||||||
if (const char* targetFlags = target->GetProperty("COMPILE_FLAGS")) {
|
if (const char* targetFlags = target->GetProperty("COMPILE_FLAGS")) {
|
||||||
// COMPILE_FLAGS are not escaped for historical reasons.
|
// COMPILE_FLAGS are not escaped for historical reasons.
|
||||||
this->AppendFlags(flags, targetFlags);
|
std::string compileFlags;
|
||||||
|
this->AppendFlags(compileFlags, targetFlags);
|
||||||
|
if (!compileFlags.empty()) {
|
||||||
|
flags.emplace_back(std::move(compileFlags));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
std::vector<std::string> targetCompileOpts;
|
std::vector<BT<std::string>> targetCompileOpts =
|
||||||
target->GetCompileOptions(targetCompileOpts, config, lang);
|
target->GetCompileOptions(config, lang);
|
||||||
// COMPILE_OPTIONS are escaped.
|
// COMPILE_OPTIONS are escaped.
|
||||||
this->AppendCompileOptions(flags, targetCompileOpts);
|
this->AppendCompileOptions(flags, targetCompileOpts);
|
||||||
}
|
}
|
||||||
@ -885,7 +903,12 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->AddCompilerRequirementFlag(flags, target, lang);
|
|
||||||
|
std::string compReqFlag;
|
||||||
|
this->AddCompilerRequirementFlag(compReqFlag, target, lang);
|
||||||
|
if (!compReqFlag.empty()) {
|
||||||
|
flags.emplace_back(std::move(compReqFlag));
|
||||||
|
}
|
||||||
|
|
||||||
// Add compile flag for the MSVC compiler only.
|
// Add compile flag for the MSVC compiler only.
|
||||||
cmMakefile* mf = this->GetMakefile();
|
cmMakefile* mf = this->GetMakefile();
|
||||||
@ -906,7 +929,11 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
|
|||||||
std::string isJMCEnabled = cge->Evaluate(this, config);
|
std::string isJMCEnabled = cge->Evaluate(this, config);
|
||||||
if (cmIsOn(isJMCEnabled)) {
|
if (cmIsOn(isJMCEnabled)) {
|
||||||
std::vector<std::string> optVec = cmExpandedList(jmc);
|
std::vector<std::string> optVec = cmExpandedList(jmc);
|
||||||
this->AppendCompileOptions(flags, optVec);
|
std::string jmcFlags;
|
||||||
|
this->AppendCompileOptions(jmcFlags, optVec);
|
||||||
|
if (!jmcFlags.empty()) {
|
||||||
|
flags.emplace_back(std::move(jmcFlags));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,6 +288,9 @@ public:
|
|||||||
|
|
||||||
void AddCompileOptions(std::string& flags, cmGeneratorTarget* target,
|
void AddCompileOptions(std::string& flags, cmGeneratorTarget* target,
|
||||||
const std::string& lang, const std::string& config);
|
const std::string& lang, const std::string& config);
|
||||||
|
void AddCompileOptions(std::vector<BT<std::string>>& flags,
|
||||||
|
cmGeneratorTarget* target, const std::string& lang,
|
||||||
|
const std::string& config);
|
||||||
|
|
||||||
std::string GetProjectName() const;
|
std::string GetProjectName() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user