Merge topic 'avoid-cmMakefile-IssueMessage-after-configure'

ea5324cd cmMakefile: Port messages for compile features to cmake
df8c3130 cmGlobalGenerator: Don't use cmMakefile::IssueMessage after configure
946d1e50 cmMakefile: Avoid IssueMessage after configure is finished
096c7754 cmLocalGenerator: Store Backtrace for the directory
This commit is contained in:
Brad King 2016-06-13 09:54:24 -04:00 committed by CMake Topic Stage
commit 18e00ac7b9
5 changed files with 49 additions and 21 deletions

View File

@ -2188,9 +2188,10 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
// Install // Install
bool skipInstallRules = mf->IsOn("CMAKE_SKIP_INSTALL_RULES"); bool skipInstallRules = mf->IsOn("CMAKE_SKIP_INSTALL_RULES");
if (this->InstallTargetEnabled && skipInstallRules) { if (this->InstallTargetEnabled && skipInstallRules) {
mf->IssueMessage(cmake::WARNING, this->CMakeInstance->IssueMessage(
"CMAKE_SKIP_INSTALL_RULES was enabled even though " cmake::WARNING, "CMAKE_SKIP_INSTALL_RULES was enabled even though "
"installation rules have been specified"); "installation rules have been specified",
mf->GetBacktrace());
} else if (this->InstallTargetEnabled && !skipInstallRules) { } else if (this->InstallTargetEnabled && !skipInstallRules) {
if (!cmakeCfgIntDir || !*cmakeCfgIntDir || cmakeCfgIntDir[0] == '.') { if (!cmakeCfgIntDir || !*cmakeCfgIntDir || cmakeCfgIntDir[0] == '.') {
std::set<std::string>* componentsSet = &this->InstallComponents; std::set<std::string>* componentsSet = &this->InstallComponents;

View File

@ -45,6 +45,7 @@
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile) cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
: cmOutputConverter(makefile->GetStateSnapshot()) : cmOutputConverter(makefile->GetStateSnapshot())
, StateSnapshot(makefile->GetStateSnapshot()) , StateSnapshot(makefile->GetStateSnapshot())
, DirectoryBacktrace(makefile->GetBacktrace())
{ {
this->GlobalGenerator = gg; this->GlobalGenerator = gg;
@ -68,7 +69,7 @@ cmLocalGenerator::~cmLocalGenerator()
void cmLocalGenerator::IssueMessage(cmake::MessageType t, void cmLocalGenerator::IssueMessage(cmake::MessageType t,
std::string const& text) const std::string const& text) const
{ {
this->Makefile->IssueMessage(t, text); this->GetCMakeInstance()->IssueMessage(t, text, this->DirectoryBacktrace);
} }
void cmLocalGenerator::ComputeObjectMaxPath() void cmLocalGenerator::ComputeObjectMaxPath()

View File

@ -373,6 +373,7 @@ protected:
cmMakefile* Makefile; cmMakefile* Makefile;
cmState::Snapshot StateSnapshot; cmState::Snapshot StateSnapshot;
cmListFileBacktrace DirectoryBacktrace;
cmGlobalGenerator* GlobalGenerator; cmGlobalGenerator* GlobalGenerator;
std::map<std::string, std::string> UniqueObjectNamesMap; std::map<std::string, std::string> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax; std::string::size_type ObjectPathMax;

View File

@ -546,7 +546,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const
case cmPolicies::WARN: case cmPolicies::WARN:
// Warn because the user did not provide a mimimum required // Warn because the user did not provide a mimimum required
// version. // version.
this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING,
msg.str(), this->Backtrace);
case cmPolicies::OLD: case cmPolicies::OLD:
// OLD behavior is to use policy version 2.4 set in // OLD behavior is to use policy version 2.4 set in
// cmListFileCache. // cmListFileCache.
@ -555,7 +556,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const
case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW: case cmPolicies::NEW:
// NEW behavior is to issue an error. // NEW behavior is to issue an error.
this->IssueMessage(cmake::FATAL_ERROR, msg.str()); this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, msg.str(),
this->Backtrace);
cmSystemTools::SetFatalErrorOccured(); cmSystemTools::SetFatalErrorOccured();
return; return;
} }
@ -651,12 +653,13 @@ void cmMakefile::ConfigureFinalPass()
const char* oldValue = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"); const char* oldValue = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
if (oldValue && if (oldValue &&
cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, oldValue, "2.4")) { cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, oldValue, "2.4")) {
this->IssueMessage( this->GetCMakeInstance()->IssueMessage(
cmake::FATAL_ERROR, cmake::FATAL_ERROR,
"You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less " "You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less "
"than 2.4. This version of CMake only supports backwards compatibility " "than 2.4. This version of CMake only supports backwards compatibility "
"with CMake 2.4 or later. For compatibility with older versions please " "with CMake 2.4 or later. For compatibility with older versions please "
"use any CMake 2.8.x release or lower."); "use any CMake 2.8.x release or lower.",
this->Backtrace);
} }
} }
@ -2048,7 +2051,8 @@ void cmMakefile::ExpandVariablesCMP0019()
<< "The following variable evaluations were encountered:\n" << "The following variable evaluations were encountered:\n"
<< w.str(); << w.str();
/* clang-format on */ /* clang-format on */
this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, m.str(),
this->Backtrace);
} }
} }
@ -4002,14 +4006,20 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target,
<< this->GetDefinition("CMAKE_" + lang + "_COMPILER_ID") << this->GetDefinition("CMAKE_" + lang + "_COMPILER_ID")
<< "\"\nversion " << "\"\nversion "
<< this->GetDefinition("CMAKE_" + lang + "_COMPILER_VERSION") << "."; << this->GetDefinition("CMAKE_" + lang + "_COMPILER_VERSION") << ".";
this->IssueMessage(cmake::FATAL_ERROR, e.str()); if (error) {
*error = e.str();
} else {
this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Backtrace);
}
return false; return false;
} }
target->AppendProperty("COMPILE_FEATURES", feature.c_str()); target->AppendProperty("COMPILE_FEATURES", feature.c_str());
return lang == "C" ? this->AddRequiredTargetCFeature(target, feature) return lang == "C"
: this->AddRequiredTargetCxxFeature(target, feature); ? this->AddRequiredTargetCFeature(target, feature, error)
: this->AddRequiredTargetCxxFeature(target, feature, error);
} }
bool cmMakefile::CompileFeatureKnown(cmTarget const* target, bool cmMakefile::CompileFeatureKnown(cmTarget const* target,
@ -4045,7 +4055,8 @@ bool cmMakefile::CompileFeatureKnown(cmTarget const* target,
if (error) { if (error) {
*error = e.str(); *error = e.str();
} else { } else {
this->IssueMessage(cmake::FATAL_ERROR, e.str()); this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Backtrace);
} }
return false; return false;
} }
@ -4070,7 +4081,8 @@ const char* cmMakefile::CompileFeaturesAvailable(const std::string& lang,
if (error) { if (error) {
*error = e.str(); *error = e.str();
} else { } else {
this->IssueMessage(cmake::FATAL_ERROR, e.str()); this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Backtrace);
} }
return 0; return 0;
} }
@ -4257,7 +4269,8 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature,
} }
bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
const std::string& feature) const const std::string& feature,
std::string* error) const
{ {
bool needCxx98 = false; bool needCxx98 = false;
bool needCxx11 = false; bool needCxx11 = false;
@ -4273,7 +4286,12 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
std::ostringstream e; std::ostringstream e;
e << "The CXX_STANDARD property on target \"" << target->GetName() e << "The CXX_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCxxStandard << "\"."; << "\" contained an invalid value: \"" << existingCxxStandard << "\".";
this->IssueMessage(cmake::FATAL_ERROR, e.str()); if (error) {
*error = e.str();
} else {
this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Backtrace);
}
return false; return false;
} }
} }
@ -4338,7 +4356,8 @@ void cmMakefile::CheckNeededCLanguage(const std::string& feature,
} }
bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target, bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target,
const std::string& feature) const const std::string& feature,
std::string* error) const
{ {
bool needC90 = false; bool needC90 = false;
bool needC99 = false; bool needC99 = false;
@ -4353,7 +4372,12 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target,
std::ostringstream e; std::ostringstream e;
e << "The C_STANDARD property on target \"" << target->GetName() e << "The C_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCStandard << "\"."; << "\" contained an invalid value: \"" << existingCStandard << "\".";
this->IssueMessage(cmake::FATAL_ERROR, e.str()); if (error) {
*error = e.str();
} else {
this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Backtrace);
}
return false; return false;
} }
} }

View File

@ -933,11 +933,12 @@ private:
std::vector<cmSourceFile*> QtUiFilesWithOptions; std::vector<cmSourceFile*> QtUiFilesWithOptions;
bool AddRequiredTargetCFeature(cmTarget* target, bool AddRequiredTargetCFeature(cmTarget* target, const std::string& feature,
const std::string& feature) const; std::string* error = 0) const;
bool AddRequiredTargetCxxFeature(cmTarget* target, bool AddRequiredTargetCxxFeature(cmTarget* target,
const std::string& feature) const; const std::string& feature,
std::string* error = 0) const;
void CheckNeededCLanguage(const std::string& feature, bool& needC90, void CheckNeededCLanguage(const std::string& feature, bool& needC90,
bool& needC99, bool& needC11) const; bool& needC99, bool& needC11) const;