summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx82
1 files changed, 43 insertions, 39 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 47c53e7..2d36315 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -32,6 +32,7 @@
#include "cmLocalGenerator.h"
#include "cmMSVC60LinkLineComputer.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmSourceFile.h"
@@ -137,7 +138,7 @@ bool cmGlobalGenerator::SetGeneratorInstance(std::string const& i,
" " << i << "\n"
"was specified.";
/* clang-format on */
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
return false;
}
@@ -157,7 +158,7 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p,
" " << p << "\n"
"was specified.";
/* clang-format on */
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
return false;
}
@@ -176,7 +177,7 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts,
" " << ts << "\n"
"was specified.";
/* clang-format on */
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
return false;
}
@@ -301,7 +302,8 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
for (cmGeneratorTarget* target : targets) {
if (target->GetType() == cmStateEnums::TargetType::GLOBAL_TARGET ||
target->GetType() == cmStateEnums::TargetType::INTERFACE_LIBRARY ||
- target->GetType() == cmStateEnums::TargetType::UTILITY) {
+ target->GetType() == cmStateEnums::TargetType::UTILITY ||
+ cmSystemTools::IsOn(target->GetProperty("ghs_integrity_app"))) {
continue;
}
@@ -319,8 +321,8 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
if (srcs.empty()) {
std::ostringstream e;
e << "No SOURCES given to target: " << target->GetName();
- this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
- target->GetBacktrace());
+ this->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR, e.str(), target->GetBacktrace());
failed = true;
}
}
@@ -354,7 +356,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
std::string setMakeProgram =
mf->GetModulesFile(this->FindMakeProgramFile.c_str());
if (!setMakeProgram.empty()) {
- mf->ReadListFile(setMakeProgram.c_str());
+ mf->ReadListFile(setMakeProgram);
}
}
if (!mf->GetDefinition("CMAKE_MAKE_PROGRAM") ||
@@ -454,7 +456,7 @@ void cmGlobalGenerator::EnableLanguage(
e << "Language '" << li
<< "' is currently being enabled. "
"Recursive call not allowed.";
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
cmSystemTools::SetFatalErrorOccured();
return;
}
@@ -471,7 +473,7 @@ void cmGlobalGenerator::EnableLanguage(
std::ostringstream e;
e << "The test project needs language " << lang
<< " which is not enabled.";
- this->TryCompileOuterMakefile->IssueMessage(cmake::FATAL_ERROR,
+ this->TryCompileOuterMakefile->IssueMessage(MessageType::FATAL_ERROR,
e.str());
cmSystemTools::SetFatalErrorOccured();
return;
@@ -521,7 +523,7 @@ void cmGlobalGenerator::EnableLanguage(
if (readCMakeSystem) {
fpath += "/CMakeSystem.cmake";
if (cmSystemTools::FileExists(fpath)) {
- mf->ReadListFile(fpath.c_str());
+ mf->ReadListFile(fpath);
}
}
// Load the CMakeDetermineSystem.cmake file and find out
@@ -550,12 +552,12 @@ void cmGlobalGenerator::EnableLanguage(
#endif
// Read the DetermineSystem file
std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
- mf->ReadListFile(systemFile.c_str());
+ mf->ReadListFile(systemFile);
// load the CMakeSystem.cmake from the binary directory
// this file is configured by the CMakeDetermineSystem.cmake file
fpath = rootBin;
fpath += "/CMakeSystem.cmake";
- mf->ReadListFile(fpath.c_str());
+ mf->ReadListFile(fpath);
}
if (readCMakeSystem) {
@@ -602,7 +604,7 @@ void cmGlobalGenerator::EnableLanguage(
// **** Load the system specific initialization if not yet loaded
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED")) {
fpath = mf->GetModulesFile("CMakeSystemSpecificInitialize.cmake");
- if (!mf->ReadListFile(fpath.c_str())) {
+ if (!mf->ReadListFile(fpath)) {
cmSystemTools::Error("Could not find cmake module file: "
"CMakeSystemSpecificInitialize.cmake");
}
@@ -634,7 +636,7 @@ void cmGlobalGenerator::EnableLanguage(
// version of CMake then try to load the configured file first
// to avoid duplicate compiler tests.
if (cmSystemTools::FileExists(fpath)) {
- if (!mf->ReadListFile(fpath.c_str())) {
+ if (!mf->ReadListFile(fpath)) {
cmSystemTools::Error("Could not find cmake module file: ",
fpath.c_str());
}
@@ -661,7 +663,7 @@ void cmGlobalGenerator::EnableLanguage(
determineCompiler += "Compiler.cmake";
std::string determineFile =
mf->GetModulesFile(determineCompiler.c_str());
- if (!mf->ReadListFile(determineFile.c_str())) {
+ if (!mf->ReadListFile(determineFile)) {
cmSystemTools::Error("Could not find cmake module file: ",
determineCompiler.c_str());
}
@@ -695,7 +697,7 @@ void cmGlobalGenerator::EnableLanguage(
fpath += "/CMake";
fpath += lang;
fpath += "Compiler.cmake";
- if (!mf->ReadListFile(fpath.c_str())) {
+ if (!mf->ReadListFile(fpath)) {
cmSystemTools::Error("Could not find cmake module file: ",
fpath.c_str());
}
@@ -712,7 +714,7 @@ void cmGlobalGenerator::EnableLanguage(
// **** Load the system specific information if not yet loaded
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED")) {
fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake");
- if (!mf->ReadListFile(fpath.c_str())) {
+ if (!mf->ReadListFile(fpath)) {
cmSystemTools::Error("Could not find cmake module file: "
"CMakeSystemSpecificInformation.cmake");
}
@@ -775,7 +777,7 @@ void cmGlobalGenerator::EnableLanguage(
if (!this->CMakeInstance->GetIsInTryCompile()) {
this->PrintCompilerAdvice(noCompiler, lang,
mf->GetDefinition(compilerEnv));
- mf->IssueMessage(cmake::FATAL_ERROR, noCompiler.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR, noCompiler.str());
fatalError = true;
}
}
@@ -792,7 +794,7 @@ void cmGlobalGenerator::EnableLanguage(
if (informationFile.empty()) {
cmSystemTools::Error("Could not find cmake module file: ",
fpath.c_str());
- } else if (!mf->ReadListFile(informationFile.c_str())) {
+ } else if (!mf->ReadListFile(informationFile)) {
cmSystemTools::Error("Could not process cmake module file: ",
informationFile.c_str());
}
@@ -813,7 +815,7 @@ void cmGlobalGenerator::EnableLanguage(
testLang += lang;
testLang += "Compiler.cmake";
std::string ifpath = mf->GetModulesFile(testLang.c_str());
- if (!mf->ReadListFile(ifpath.c_str())) {
+ if (!mf->ReadListFile(ifpath)) {
cmSystemTools::Error("Could not find cmake module file: ",
testLang.c_str());
}
@@ -851,7 +853,7 @@ void cmGlobalGenerator::EnableLanguage(
projectCompatibility += mf->GetSafeDefinition("PROJECT_NAME");
projectCompatibility += "Compatibility.cmake";
if (cmSystemTools::FileExists(projectCompatibility)) {
- mf->ReadListFile(projectCompatibility.c_str());
+ mf->ReadListFile(projectCompatibility);
}
// Inform any extra generator of the new language.
if (this->ExtraGenerator) {
@@ -903,7 +905,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
" compiler id \"AppleClang\" to \"Clang\" for compatibility."
;
/* clang-format on */
- mf->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
}
CM_FALLTHROUGH;
case cmPolicies::OLD:
@@ -913,7 +915,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
mf->IssueMessage(
- cmake::FATAL_ERROR,
+ MessageType::FATAL_ERROR,
cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0025));
case cmPolicies::NEW:
// NEW behavior is to keep AppleClang.
@@ -933,7 +935,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
" compiler id \"QCC\" to \"GNU\" for compatibility."
;
/* clang-format on */
- mf->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
}
CM_FALLTHROUGH;
case cmPolicies::OLD:
@@ -948,7 +950,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
mf->IssueMessage(
- cmake::FATAL_ERROR,
+ MessageType::FATAL_ERROR,
cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0047));
CM_FALLTHROUGH;
case cmPolicies::NEW:
@@ -1410,13 +1412,13 @@ void cmGlobalGenerator::Generate()
if (!this->GenerateCPackPropertiesFile()) {
this->GetCMakeInstance()->IssueMessage(
- cmake::FATAL_ERROR, "Could not write CPack properties file.");
+ MessageType::FATAL_ERROR, "Could not write CPack properties file.");
}
for (auto& buildExpSet : this->BuildExportSets) {
if (!buildExpSet.second->GenerateImportFile()) {
if (!cmSystemTools::GetErrorOccuredFlag()) {
- this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR,
+ this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR,
"Could not write export file.");
}
return;
@@ -1439,7 +1441,8 @@ void cmGlobalGenerator::Generate()
for (std::string const& t : this->CMP0042WarnTargets) {
w << " " << t << "\n";
}
- this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING,
+ w.str());
}
if (!this->CMP0068WarnTargets.empty()) {
@@ -1455,7 +1458,8 @@ void cmGlobalGenerator::Generate()
for (std::string const& t : this->CMP0068WarnTargets) {
w << " " << t << "\n";
}
- this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING,
+ w.str());
}
this->CMakeInstance->UpdateProgress("Generating done", -1);
@@ -1758,7 +1762,7 @@ void cmGlobalGenerator::GenerateBuildCommand(
bool /*unused*/, int /*unused*/, bool /*unused*/,
std::vector<std::string> const& /*unused*/)
{
- makeCommand.push_back(
+ makeCommand.emplace_back(
"cmGlobalGenerator::GenerateBuildCommand not implemented");
}
@@ -2233,7 +2237,7 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
if (!tgt) {
return true;
}
- cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ MessageType messageType = MessageType::AUTHOR_WARNING;
std::ostringstream e;
bool issueMessage = false;
switch (tgt->GetPolicyStatusCMP0037()) {
@@ -2247,18 +2251,18 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
issueMessage = true;
- messageType = cmake::FATAL_ERROR;
+ messageType = MessageType::FATAL_ERROR;
break;
}
if (issueMessage) {
e << "The target name \"" << targetName << "\" is reserved " << reason
<< ".";
- if (messageType == cmake::AUTHOR_WARNING) {
+ if (messageType == MessageType::AUTHOR_WARNING) {
e << " It may result in undefined behavior.";
}
this->GetCMakeInstance()->IssueMessage(messageType, e.str(),
tgt->GetBacktrace());
- if (messageType == cmake::FATAL_ERROR) {
+ if (messageType == MessageType::FATAL_ERROR) {
return false;
}
}
@@ -2310,12 +2314,12 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
singleLine.push_back("./CPackConfig.cmake");
gti.CommandLines.push_back(std::move(singleLine));
if (this->GetPreinstallTargetName()) {
- gti.Depends.push_back(this->GetPreinstallTargetName());
+ gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else {
const char* noPackageAll =
mf->GetDefinition("CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY");
if (!noPackageAll || cmSystemTools::IsOff(noPackageAll)) {
- gti.Depends.push_back(this->GetAllTargetName());
+ gti.Depends.emplace_back(this->GetAllTargetName());
}
}
targets.push_back(std::move(gti));
@@ -2453,7 +2457,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
bool skipInstallRules = mf->IsOn("CMAKE_SKIP_INSTALL_RULES");
if (this->InstallTargetEnabled && skipInstallRules) {
this->CMakeInstance->IssueMessage(
- cmake::WARNING,
+ MessageType::WARNING,
"CMAKE_SKIP_INSTALL_RULES was enabled even though "
"installation rules have been specified",
mf->GetBacktrace());
@@ -2480,12 +2484,12 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
gti.UsesTerminal = true;
cmCustomCommandLine singleLine;
if (this->GetPreinstallTargetName()) {
- gti.Depends.push_back(this->GetPreinstallTargetName());
+ gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else {
const char* noall =
mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
if (!noall || cmSystemTools::IsOff(noall)) {
- gti.Depends.push_back(this->GetAllTargetName());
+ gti.Depends.emplace_back(this->GetAllTargetName());
}
}
if (mf->GetDefinition("CMake_BINARY_DIR") &&