Commit 64b55203 authored by Brad King's avatar Brad King

Isolate formatted streaming blocks with clang-format off/on

The clang-format tool can do a good job formatting most code, but
well-organized streaming blocks are best left manually formatted.

Find blocks of the form

    os <<
      "...\n"
      "...\n"
      ;

using the command

    $ git ls-files -z -- Source |
      egrep -v -z '^Source/kwsys/' |
      xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \
        '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}'

Find blocks of the form

    os << "...\n"
       << "...\n"
       << "...\n";

using the command

    $ git ls-files -z -- Source |
      egrep -v -z '^Source/kwsys/' |
      xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \
        '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}'

Surround such blocks with the pair

    /* clang-format off */
    ...
    /* clang-format on */

in order to protect them from update by clang-format.  Use the C-style
`/*...*/` comments instead of C++-style `//...` comments in order to
prevent them from ever being swallowed by re-formatting of surrounding
comments.
parent 73601ff8
......@@ -881,6 +881,7 @@ CreateComponentDescription(cmCPackComponent *component,
totalSizeInKbytes = 1;
}
std::ostringstream out;
/* clang-format off */
out << " AddSize " << totalSizeInKbytes << "\n"
<< " Push \"" << component->ArchiveFile << "\"\n"
<< " Call DownloadFile\n"
......@@ -890,6 +891,7 @@ CreateComponentDescription(cmCPackComponent *component,
" StrCmp $2 \"success\" +2 0\n"
" MessageBox MB_OK \"Failed to unzip $2\"\n"
" Delete $INSTDIR\\$0\n";
/* clang-format on */
componentCode += out.str();
}
else
......
......@@ -151,6 +151,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
else
{
std::ostringstream ostr;
/* clang-format off */
ostr << "has no project to build. If this is a "
"\"built with CMake\" project, verify that CTEST_CMAKE_GENERATOR "
"and CTEST_PROJECT_NAME are set."
......@@ -162,6 +163,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
"\n"
"Alternatively, set CTEST_BUILD_COMMAND to build the project "
"with a custom command line.";
/* clang-format on */
this->SetError(ostr.str());
return 0;
}
......
......@@ -203,9 +203,11 @@ private:
if(!this->Rev.Rev.empty())
{
// Record this revision.
/* clang-format off */
this->CVS->Log << "Found revision " << this->Rev.Rev << "\n"
<< " author = " << this->Rev.Author << "\n"
<< " date = " << this->Rev.Date << "\n";
/* clang-format on */
this->Revisions.push_back(this->Rev);
// We only need two revisions.
......
......@@ -54,9 +54,11 @@ void cmCTestGlobalVC::DoRevision(Revision const& revision,
// Report this revision.
Revision const& rev = this->Revisions.back();
/* clang-format off */
this->Log << "Found revision " << rev.Rev << "\n"
<< " author = " << rev.Author << "\n"
<< " date = " << rev.Date << "\n";
/* clang-format on */
// Update information about revisions of the changed files.
for(std::vector<Change>::const_iterator ci = changes.begin();
......
......@@ -382,11 +382,13 @@ void cmCTestMultiProcessHandler::StartNextTests()
}
else
{
/* clang-format off */
cmCTestLog(this->CTest, HANDLER_OUTPUT,
"System Load: " << systemLoad << ", "
"Max Allowed Load: " << this->TestLoad << ", "
"Smallest test " << testWithMinProcessors <<
" requires " << minProcessorsRequired);
/* clang-format on */
}
cmCTestLog(this->CTest, HANDLER_OUTPUT, "*****" << std::endl);
......
......@@ -933,12 +933,14 @@ bool cmCTestSubmitHandler::SubmitUsingCP(
if ( localprefix.empty() ||
files.empty() || remoteprefix.empty() || destination.empty() )
{
/* clang-format off */
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Missing arguments for submit via cp:\n"
<< "\tlocalprefix: " << localprefix << "\n"
<< "\tNumber of files: " << files.size() << "\n"
<< "\tremoteprefix: " << remoteprefix << "\n"
<< "\tdestination: " << destination << std::endl);
/* clang-format on */
return 0;
}
......
......@@ -206,10 +206,12 @@ bool cmAddCustomTargetCommand
}
if (issueMessage)
{
/* clang-format off */
e << "The target name \"" << targetName <<
"\" is reserved or not valid for certain "
"CMake features, such as generator expressions, and may result "
"in undefined behavior.";
/* clang-format on */
this->Makefile->IssueMessage(messageType, e.str());
if (messageType == cmake::FATAL_ERROR)
......
......@@ -96,10 +96,12 @@ bool cmAddExecutableCommand
}
if (issueMessage)
{
/* clang-format off */
e << "The target name \"" << exename <<
"\" is reserved or not valid for certain "
"CMake features, such as generator expressions, and may result "
"in undefined behavior.";
/* clang-format on */
this->Makefile->IssueMessage(messageType, e.str());
if (messageType == cmake::FATAL_ERROR)
......
......@@ -318,11 +318,14 @@ bool cmCacheManager::SaveCache(const std::string& path)
"This is the directory where this CMakeCache.txt"
" was created", cmState::INTERNAL);
/* clang-format off */
fout << "# This is the CMakeCache file.\n"
<< "# For build in directory: " << currentcwd << "\n"
<< "# It was generated by CMake: "
<< cmSystemTools::GetCMakeCommand() << std::endl;
/* clang-format on */
/* clang-format off */
fout << "# You can edit this file to change values found and used by cmake."
<< std::endl
<< "# If you do not want to change any of the values, simply exit the "
......@@ -335,6 +338,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
<< "# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT "
"TYPE!." << std::endl
<< "# VALUE is the current value for the KEY.\n\n";
/* clang-format on */
fout << "########################\n";
fout << "# EXTERNAL cache entries\n";
......
......@@ -562,6 +562,7 @@ bool cmComputeLinkInformation::Compute()
if (!this->CMP0060WarnItems.empty())
{
std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0060) << "\n"
"Some library files are in directories implicitly searched by "
"the linker when invoked for " << this->LinkLanguage << ":\n"
......@@ -570,6 +571,7 @@ bool cmComputeLinkInformation::Compute()
"link line will ask the linker to search for these by library "
"name."
;
/* clang-format on */
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
this->Target->GetBacktrace());
}
......@@ -1543,10 +1545,12 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
{
this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1");
std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0008) << "\n"
<< "Target \"" << this->Target->GetName() << "\" links to item\n"
<< " " << item << "\n"
<< "which is a full-path but not a valid library file name.";
/* clang-format on */
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
this->Target->GetBacktrace());
}
......@@ -1561,10 +1565,12 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
case cmPolicies::REQUIRED_ALWAYS:
{
std::ostringstream e;
/* clang-format off */
e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0008) << "\n"
<< "Target \"" << this->Target->GetName() << "\" links to item\n"
<< " " << item << "\n"
<< "which is a full-path but not a valid library file name.";
/* clang-format on */
this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Target->GetBacktrace());
}
......@@ -1629,6 +1635,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
{
// Tell the user what to do.
/* clang-format off */
os << "Policy CMP0003 should be set before this line. "
<< "Add code such as\n"
<< " if(COMMAND cmake_policy)\n"
......@@ -1636,6 +1643,7 @@ void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
<< " endif(COMMAND cmake_policy)\n"
<< "as early as possible but after the most recent call to "
<< "cmake_minimum_required or cmake_policy(VERSION). ";
/* clang-format on */
// List the items that might need the old-style paths.
os << "This warning appears because target \""
......
......@@ -35,9 +35,11 @@ bool cmConfigureFileCommand
if(cmSystemTools::FileIsDirectory(this->InputFile))
{
std::ostringstream e;
/* clang-format off */
e << "input location\n"
<< " " << this->InputFile << "\n"
<< "is a directory but a file was expected.";
/* clang-format on */
this->SetError(e.str());
return false;
}
......
......@@ -307,9 +307,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
if (!fout)
{
std::ostringstream e;
/* clang-format off */
e << "Failed to open\n"
<< " " << outFileName << "\n"
<< cmSystemTools::GetLastSystemError();
/* clang-format on */
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return -1;
}
......@@ -369,11 +371,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
"CMAKE_POLICY_WARNING_CMP0056"))
{
std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0056) << "\n"
"For compatibility with older versions of CMake, try_compile "
"is not honoring caller link flags (e.g. CMAKE_EXE_LINKER_FLAGS) "
"in the test project."
;
/* clang-format on */
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
}
case cmPolicies::OLD:
......@@ -608,10 +612,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
copyFile))
{
std::ostringstream emsg;
/* clang-format off */
emsg << "Cannot copy output executable\n"
<< " '" << this->OutputFile << "'\n"
<< "to destination specified by COPY_FILE:\n"
<< " '" << copyFile << "'\n";
/* clang-format on */
if(!this->FindErrorMessage.empty())
{
emsg << this->FindErrorMessage.c_str();
......
......@@ -94,12 +94,14 @@ cmDocumentation::~cmDocumentation()
//----------------------------------------------------------------------------
bool cmDocumentation::PrintVersion(std::ostream& os)
{
/* clang-format off */
os <<
this->GetNameString() <<
" version " << cmVersion::GetCMakeVersion() << "\n"
"\n"
"CMake suite maintained and supported by Kitware (kitware.com/cmake).\n"
;
/* clang-format on */
return true;
}
......@@ -935,6 +937,7 @@ bool cmDocumentation::PrintOldCustomModules(std::ostream& os)
}
else if((ext.length()==2) && (ext[1] >='1') && (ext[1]<='9'))
{
/* clang-format off */
os <<
".TH " << name << " " << ext[1] << " \"" <<
cmSystemTools::GetCurrentDateTime("%B %d, %Y") <<
......@@ -947,6 +950,7 @@ bool cmDocumentation::PrintOldCustomModules(std::ostream& os)
".PP\n" <<
detail
;
/* clang-format on */
}
else
{
......
......@@ -406,9 +406,11 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
else
{
std::ostringstream e;
/* clang-format off */
e << "Cannot create package registry file:\n"
<< " " << fname << "\n"
<< cmSystemTools::GetLastSystemError() << "\n";
/* clang-format on */
this->Makefile->IssueMessage(cmake::WARNING, e.str());
}
}
......
......@@ -106,17 +106,21 @@ bool cmExportFileGenerator::GenerateImportFile()
std::ostream& os = *foutPtr;
// Protect that file against use with older CMake versions.
/* clang-format off */
os << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n"
<< " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n"
<< "endif()\n";
/* clang-format on */
// Isolate the file policy level.
// We use 2.6 here instead of the current version because newer
// versions of CMake should be able to export files imported by 2.6
// until the import format changes.
/* clang-format off */
os << "cmake_policy(PUSH)\n"
<< "cmake_policy(VERSION 2.6)\n";
/* clang-format on */
// Start with the import file header.
this->GenerateImportHeaderCode(os);
......@@ -197,10 +201,12 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os,
const char *versionString)
{
/* clang-format off */
os << "if(CMAKE_VERSION VERSION_LESS " << versionString << ")\n"
" message(FATAL_ERROR \"This file relies on consumers using "
"CMake " << versionString << " or greater.\")\n"
"endif()\n\n";
/* clang-format on */
}
//----------------------------------------------------------------------------
......@@ -296,9 +302,11 @@ static bool checkInterfaceDirs(const std::string &prepro,
}
if (!cmSystemTools::FileIsFullPath(li->c_str()))
{
/* clang-format off */
e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains relative path:\n"
" \"" << *li << "\"";
/* clang-format on */
target->GetLocalGenerator()->IssueMessage(messageType, e.str());
}
bool inBinary = isSubDirectory(li->c_str(), topBinaryDir);
......@@ -350,9 +358,11 @@ static bool checkInterfaceDirs(const std::string &prepro,
}
if (inBinary)
{
/* clang-format off */
e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains path:\n"
" \"" << *li << "\"\nwhich is prefixed in the build directory.";
/* clang-format on */
target->GetLocalGenerator()->IssueMessage(messageType, e.str());
}
if (!inSourceBuild)
......@@ -1016,15 +1026,18 @@ void cmExportFileGenerator::GenerateImportVersionCode(std::ostream& os)
{
// Store an import file format version. This will let us change the
// format later while still allowing old import files to work.
/* clang-format off */
os << "# Commands may need to know the format version.\n"
<< "set(CMAKE_IMPORT_FILE_VERSION 1)\n"
<< "\n";
/* clang-format on */
}
//----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
const std::string &expectedTargets)
{
/* clang-format off */
os << "# Protect against multiple inclusion, which would fail when already "
"imported targets are added once more.\n"
"set(_targetsDefined)\n"
......@@ -1053,6 +1066,7 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
"unset(_targetsNotDefined)\n"
"unset(_expectedTargets)\n"
"\n\n";
/* clang-format on */
}
//----------------------------------------------------------------------------
void
......@@ -1163,15 +1177,19 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
{
if (missingTargets.empty())
{
/* clang-format off */
os << "# This file does not depend on other imported targets which have\n"
"# been exported from the same project but in a separate "
"export set.\n\n";
/* clang-format on */
return;
}
/* clang-format off */
os << "# Make sure the targets which have been exported in some other \n"
"# export set exist.\n"
"unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
"foreach(_target ";
/* clang-format on */
std::set<std::string> emitted;
for(unsigned int i=0; i<missingTargets.size(); ++i)
{
......@@ -1180,6 +1198,7 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
os << "\"" << missingTargets[i] << "\" ";
}
}
/* clang-format off */
os << ")\n"
" if(NOT TARGET \"${_target}\" )\n"
" set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets \""
......@@ -1203,6 +1222,7 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
"endif()\n"
"unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
"\n";
/* clang-format on */
}
......@@ -1217,6 +1237,7 @@ cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
// the non-development package, something similar happened to me without
// on SUSE with a mysql pkg-config file, which claimed everything is fine,
// but the development package was not installed.).
/* clang-format off */
os << "# Loop over all imported files and verify that they actually exist\n"
"foreach(target ${_IMPORT_CHECK_TARGETS} )\n"
" foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n"
......@@ -1237,6 +1258,7 @@ cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
"endforeach()\n"
"unset(_IMPORT_CHECK_TARGETS)\n"
"\n";
/* clang-format on */
}
......
......@@ -80,10 +80,12 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{
// The export file is being installed to an absolute path so the
// package is not relocatable. Use the configured install prefix.
/* clang-format off */
os <<
"# The installation prefix configured by this project.\n"
"set(_IMPORT_PREFIX \"" << installPrefix << "\")\n"
"\n";
/* clang-format on */
}
else
{
......@@ -100,6 +102,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/"))
{
// Handle "/usr move" symlinks created by some Linux distros.
/* clang-format off */
os <<
"# Use original install prefix when loaded through a\n"
"# cross-prefix symbolic link such as /lib -> /usr/lib.\n"
......@@ -110,6 +113,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
"endif()\n"
"unset(_realOrig)\n"
"unset(_realCurr)\n";
/* clang-format on */
}
std::string dest = expDest;
while(!dest.empty())
......@@ -214,6 +218,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
}
// Now load per-configuration properties for them.
/* clang-format off */
os << "# Load information for each installed configuration.\n"
<< "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"
<< "file(GLOB CONFIG_FILES \"${_DIR}/"
......@@ -222,11 +227,14 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
<< " include(${f})\n"
<< "endforeach()\n"
<< "\n";
/* clang-format on */
// Cleanup the import prefix variable.
/* clang-format off */
os << "# Cleanup temporary variables.\n"
<< "set(_IMPORT_PREFIX)\n"
<< "\n";
/* clang-format on */
this->GenerateImportedFileCheckLoop(os);
bool result = true;
......
......@@ -569,10 +569,12 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
cmGeneratedFileStream fout(filename.c_str());
if(fout)
{
/* clang-format off */
fout << "# This is a dummy file for the OBJECT library "
<< target->GetName()
<< " for the CMake CodeBlocks project generator.\n"
<< "# Don't edit, this file will be overwritten.\n";
/* clang-format on */
}
return filename;
}
......
......@@ -69,11 +69,13 @@ void cmExtraKateGenerator::CreateKateProjectFile(
return;
}
/* clang-format off */
fout <<
"{\n"
"\t\"name\": \"" << this->ProjectName << "\",\n"
"\t\"directory\": \"" << lg->GetSourceDirectory() << "\",\n"
"\t\"files\": [ { " << this->GenerateFilesString(lg) << "} ],\n";
/* clang-format on */
this->WriteTargets(lg, fout);
fout << "}\n";
}
......@@ -89,11 +91,13 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
"CMAKE_KATE_MAKE_ARGUMENTS");
const char* homeOutputDir = lg->GetBinaryDirectory();
/* clang-format off */
fout <<
"\t\"build\": {\n"
"\t\t\"directory\": \"" << lg->GetBinaryDirectory() << "\",\n"
"\t\t\"default_target\": \"all\",\n"
"\t\t\"clean_target\": \"clean\",\n";
/* clang-format on */
// build, clean and quick are for the build plugin kate <= 4.12:
fout << "\t\t\"build\": \"" << make << " -C \\\"" << homeOutputDir
......
......@@ -2436,11 +2436,13 @@ cmFileCommand::HandleRPathChangeCommand(std::vector<std::string> const& args)
if(!cmSystemTools::ChangeRPath(file, oldRPath, newRPath, &emsg, &changed))
{
std::ostringstream e;
/* clang-format off */
e << "RPATH_CHANGE could not write new RPATH:\n"
<< " " << newRPath << "\n"
<< "to the file:\n"
<< " " << file << "\n"
<< emsg;
/* clang-format on */
this->SetError(e.str());
success = false;
}
......@@ -2511,9 +2513,11 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args)
if(!cmSystemTools::RemoveRPath(file, &emsg, &removed))
{
std::ostringstream e;
/* clang-format off */
e << "RPATH_REMOVE could not remove RPATH from file:\n"
<< " " << file << "\n"
<< emsg;
/* clang-format on */
this->SetError(e.str());
success = false;
}
......@@ -2668,11 +2672,13 @@ bool cmFileCommand::HandleRename(std::vector<std::string> const& args)
{
std::string err = cmSystemTools::GetLastSystemError();
std::ostringstream e;
/* clang-format off */
e << "RENAME failed to rename\n"
<< " " << oldname << "\n"
<< "to\n"
<< " " << newname << "\n"
<< "because: " << err << "\n";
/* clang-format on */
this->SetError(e.str());
return false;
}
......
......@@ -748,10 +748,12 @@ bool cmFindPackageCommand::HandlePackageMode()
std::ostringstream aw;
if (configFileSetFOUNDFalse)
{
/* clang-format off */
e << "Found package configuration file:\n"
" " << this->FileFound << "\n"
"but it set " << foundVar << " to FALSE so package \"" <<
this->Name << "\" is considered to be NOT FOUND.";
/* clang-format on */
if (!notFoundMessage.empty())
{
e << " Reason given by package: \n" << notFoundMessage << "\n";
......
......@@ -118,9 +118,11 @@ void cmGeneratorExpressionDAGChecker::ReportError(
{
std::ostringstream e;
/* clang-format off */
e << "Error evaluating generator expression:\n"
<< " " << expr << "\n"
<< "Dependency loop found.";
/* clang-format on */
context->LG->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR, e.str(),
context->Backtrace);
......
......@@ -1898,9 +1898,11 @@ void reportError(cmGeneratorExpressionContext *context,
}
std::ostringstream e;
/* clang-format off */
e << "Error evaluating generator expression:\n"
<< " " << expr << "\n"
<< result;
/* clang-format on */
context->LG->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR, e.str(),
context->Backtrace);
......
......@@ -2693,6 +2693,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
break;
}
}
/* clang-format off */
e << "Imported target \"" << targetName << "\" includes "
"non-existent path\n \"" << *li << "\"\nin its "
"INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n"
......@@ -2702,6 +2703,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
"successfully.\n"
"* The installation package was faulty and references files it "
"does not provide.\n";
/* clang-format on */
tgt->GetLocalGenerator()->IssueMessage(messageType, e.str());
return;
}
......@@ -2713,9 +2715,11 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
cmake::MessageType messageType = cmake::FATAL_ERROR;
if (!targetName.empty())
{
/* clang-format off */
e << "Target \"" << targetName << "\" contains relative "
"path in its INTERFACE_INCLUDE_DIRECTORIES:\n"
" \"" << *li << "\"";
/* clang-format on */
}
else
{
......@@ -5198,6 +5202,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
&& strcmp(newExplicitLibraries, explicitLibraries) != 0)
{
std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
"Target \"" << this->GetName() << "\" has an "
"INTERFACE_LINK_LIBRARIES property which differs from its " <<
......@@ -5207,6 +5212,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
" " << newExplicitLibraries << "\n" <<
linkIfaceProp << ":\n"
" " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n";
/* clang-format on */
this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str());
this->PolicyWarnedCMP0022 = true;
}
......@@ -5269,6 +5275,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
{ newLibraries = "(empty)"; }
std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
"Target \"" << this->GetName() << "\" has an "
"INTERFACE_LINK_LIBRARIES property. "
......@@ -5281,6 +5288,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
" " << newLibraries << "\n"
"Link implementation:\n"
" " << oldLibraries << "\n";
/* clang-format on */
this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str());
this->PolicyWarnedCMP0022 = true;
}
......@@ -5630,6 +5638,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles(
sep = "\n ";
}
std::ostringstream e;
/* clang-format off */
e << "Target \"" << this->GetName()
<< "\" has source files which vary by "
"configuration. This is not supported by the \""
......@@ -5639,6 +5648,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles(
" " << firstConfigFiles << "\n"
"Config \"" << *it << "\":\n"
" " << thisConfigFiles << "\n";
/* clang-format on */
this->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
......
......@@ -111,12 +111,14 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p,
}
std::ostringstream e;
/* clang-format off */
e <<
"Generator\n"
" " << this->GetName() << "\n"
"does not support platform specification, but platform\n"
" " << p << "\n"
"was specified.";
/* clang-format on */
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
......@@ -129,12 +131,14 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts,
return true;
}
std::ostringstream e;
/* clang-format off */
e <<
"Generator\n"
" " << this->GetName() << "\n"
"does not support toolset specification, but toolset\n"
" " << ts << "\n"
"was specified.";
/* clang-format on */
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
......@@ -696,28 +700,34 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
if(!compilerFile || !*compilerFile ||
cmSystemTools::IsNOTFOUND(compilerFile))
{
/* clang-format off */
noCompiler <<
"No " << compilerName << " could be found.\n"
;
/* clang-format on */
}
else if(strcmp(lang, "RC") != 0 &&
strcmp(lang, "ASM_MASM") != 0)
{
if(!cmSystemTools::FileIsFullPath(compilerFile))
{
/* clang-format off */
noCompiler <<
"The " << compilerName << ":\n"
" " << compilerFile << "\n"
"is not a full path and was not found in the PATH.\n"
;
/* clang-format on */