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.
This commit is contained in:
Brad King 2016-05-06 14:19:04 -04:00
parent 73601ff831
commit 64b5520346
46 changed files with 282 additions and 0 deletions

View File

@ -881,6 +881,7 @@ CreateComponentDescription(cmCPackComponent *component,
totalSizeInKbytes = 1; totalSizeInKbytes = 1;
} }
std::ostringstream out; std::ostringstream out;
/* clang-format off */
out << " AddSize " << totalSizeInKbytes << "\n" out << " AddSize " << totalSizeInKbytes << "\n"
<< " Push \"" << component->ArchiveFile << "\"\n" << " Push \"" << component->ArchiveFile << "\"\n"
<< " Call DownloadFile\n" << " Call DownloadFile\n"
@ -890,6 +891,7 @@ CreateComponentDescription(cmCPackComponent *component,
" StrCmp $2 \"success\" +2 0\n" " StrCmp $2 \"success\" +2 0\n"
" MessageBox MB_OK \"Failed to unzip $2\"\n" " MessageBox MB_OK \"Failed to unzip $2\"\n"
" Delete $INSTDIR\\$0\n"; " Delete $INSTDIR\\$0\n";
/* clang-format on */
componentCode += out.str(); componentCode += out.str();
} }
else else

View File

@ -151,6 +151,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
else else
{ {
std::ostringstream ostr; std::ostringstream ostr;
/* clang-format off */
ostr << "has no project to build. If this is a " ostr << "has no project to build. If this is a "
"\"built with CMake\" project, verify that CTEST_CMAKE_GENERATOR " "\"built with CMake\" project, verify that CTEST_CMAKE_GENERATOR "
"and CTEST_PROJECT_NAME are set." "and CTEST_PROJECT_NAME are set."
@ -162,6 +163,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
"\n" "\n"
"Alternatively, set CTEST_BUILD_COMMAND to build the project " "Alternatively, set CTEST_BUILD_COMMAND to build the project "
"with a custom command line."; "with a custom command line.";
/* clang-format on */
this->SetError(ostr.str()); this->SetError(ostr.str());
return 0; return 0;
} }

View File

@ -203,9 +203,11 @@ private:
if(!this->Rev.Rev.empty()) if(!this->Rev.Rev.empty())
{ {
// Record this revision. // Record this revision.
/* clang-format off */
this->CVS->Log << "Found revision " << this->Rev.Rev << "\n" this->CVS->Log << "Found revision " << this->Rev.Rev << "\n"
<< " author = " << this->Rev.Author << "\n" << " author = " << this->Rev.Author << "\n"
<< " date = " << this->Rev.Date << "\n"; << " date = " << this->Rev.Date << "\n";
/* clang-format on */
this->Revisions.push_back(this->Rev); this->Revisions.push_back(this->Rev);
// We only need two revisions. // We only need two revisions.

View File

@ -54,9 +54,11 @@ void cmCTestGlobalVC::DoRevision(Revision const& revision,
// Report this revision. // Report this revision.
Revision const& rev = this->Revisions.back(); Revision const& rev = this->Revisions.back();
/* clang-format off */
this->Log << "Found revision " << rev.Rev << "\n" this->Log << "Found revision " << rev.Rev << "\n"
<< " author = " << rev.Author << "\n" << " author = " << rev.Author << "\n"
<< " date = " << rev.Date << "\n"; << " date = " << rev.Date << "\n";
/* clang-format on */
// Update information about revisions of the changed files. // Update information about revisions of the changed files.
for(std::vector<Change>::const_iterator ci = changes.begin(); for(std::vector<Change>::const_iterator ci = changes.begin();

View File

@ -382,11 +382,13 @@ void cmCTestMultiProcessHandler::StartNextTests()
} }
else else
{ {
/* clang-format off */
cmCTestLog(this->CTest, HANDLER_OUTPUT, cmCTestLog(this->CTest, HANDLER_OUTPUT,
"System Load: " << systemLoad << ", " "System Load: " << systemLoad << ", "
"Max Allowed Load: " << this->TestLoad << ", " "Max Allowed Load: " << this->TestLoad << ", "
"Smallest test " << testWithMinProcessors << "Smallest test " << testWithMinProcessors <<
" requires " << minProcessorsRequired); " requires " << minProcessorsRequired);
/* clang-format on */
} }
cmCTestLog(this->CTest, HANDLER_OUTPUT, "*****" << std::endl); cmCTestLog(this->CTest, HANDLER_OUTPUT, "*****" << std::endl);

View File

@ -933,12 +933,14 @@ bool cmCTestSubmitHandler::SubmitUsingCP(
if ( localprefix.empty() || if ( localprefix.empty() ||
files.empty() || remoteprefix.empty() || destination.empty() ) files.empty() || remoteprefix.empty() || destination.empty() )
{ {
/* clang-format off */
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,
"Missing arguments for submit via cp:\n" "Missing arguments for submit via cp:\n"
<< "\tlocalprefix: " << localprefix << "\n" << "\tlocalprefix: " << localprefix << "\n"
<< "\tNumber of files: " << files.size() << "\n" << "\tNumber of files: " << files.size() << "\n"
<< "\tremoteprefix: " << remoteprefix << "\n" << "\tremoteprefix: " << remoteprefix << "\n"
<< "\tdestination: " << destination << std::endl); << "\tdestination: " << destination << std::endl);
/* clang-format on */
return 0; return 0;
} }

View File

@ -206,10 +206,12 @@ bool cmAddCustomTargetCommand
} }
if (issueMessage) if (issueMessage)
{ {
/* clang-format off */
e << "The target name \"" << targetName << e << "The target name \"" << targetName <<
"\" is reserved or not valid for certain " "\" is reserved or not valid for certain "
"CMake features, such as generator expressions, and may result " "CMake features, such as generator expressions, and may result "
"in undefined behavior."; "in undefined behavior.";
/* clang-format on */
this->Makefile->IssueMessage(messageType, e.str()); this->Makefile->IssueMessage(messageType, e.str());
if (messageType == cmake::FATAL_ERROR) if (messageType == cmake::FATAL_ERROR)

View File

@ -96,10 +96,12 @@ bool cmAddExecutableCommand
} }
if (issueMessage) if (issueMessage)
{ {
/* clang-format off */
e << "The target name \"" << exename << e << "The target name \"" << exename <<
"\" is reserved or not valid for certain " "\" is reserved or not valid for certain "
"CMake features, such as generator expressions, and may result " "CMake features, such as generator expressions, and may result "
"in undefined behavior."; "in undefined behavior.";
/* clang-format on */
this->Makefile->IssueMessage(messageType, e.str()); this->Makefile->IssueMessage(messageType, e.str());
if (messageType == cmake::FATAL_ERROR) if (messageType == cmake::FATAL_ERROR)

View File

@ -318,11 +318,14 @@ bool cmCacheManager::SaveCache(const std::string& path)
"This is the directory where this CMakeCache.txt" "This is the directory where this CMakeCache.txt"
" was created", cmState::INTERNAL); " was created", cmState::INTERNAL);
/* clang-format off */
fout << "# This is the CMakeCache file.\n" fout << "# This is the CMakeCache file.\n"
<< "# For build in directory: " << currentcwd << "\n" << "# For build in directory: " << currentcwd << "\n"
<< "# It was generated by CMake: " << "# It was generated by CMake: "
<< cmSystemTools::GetCMakeCommand() << std::endl; << cmSystemTools::GetCMakeCommand() << std::endl;
/* clang-format on */
/* clang-format off */
fout << "# You can edit this file to change values found and used by cmake." fout << "# You can edit this file to change values found and used by cmake."
<< std::endl << std::endl
<< "# If you do not want to change any of the values, simply exit the " << "# 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 is a hint to GUIs for the type of VALUE, DO NOT EDIT "
"TYPE!." << std::endl "TYPE!." << std::endl
<< "# VALUE is the current value for the KEY.\n\n"; << "# VALUE is the current value for the KEY.\n\n";
/* clang-format on */
fout << "########################\n"; fout << "########################\n";
fout << "# EXTERNAL cache entries\n"; fout << "# EXTERNAL cache entries\n";

View File

@ -562,6 +562,7 @@ bool cmComputeLinkInformation::Compute()
if (!this->CMP0060WarnItems.empty()) if (!this->CMP0060WarnItems.empty())
{ {
std::ostringstream w; std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0060) << "\n" w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0060) << "\n"
"Some library files are in directories implicitly searched by " "Some library files are in directories implicitly searched by "
"the linker when invoked for " << this->LinkLanguage << ":\n" "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 " "link line will ask the linker to search for these by library "
"name." "name."
; ;
/* clang-format on */
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
this->Target->GetBacktrace()); this->Target->GetBacktrace());
} }
@ -1543,10 +1545,12 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
{ {
this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1"); this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1");
std::ostringstream w; std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0008) << "\n" w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0008) << "\n"
<< "Target \"" << this->Target->GetName() << "\" links to item\n" << "Target \"" << this->Target->GetName() << "\" links to item\n"
<< " " << item << "\n" << " " << item << "\n"
<< "which is a full-path but not a valid library file name."; << "which is a full-path but not a valid library file name.";
/* clang-format on */
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
this->Target->GetBacktrace()); this->Target->GetBacktrace());
} }
@ -1561,10 +1565,12 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_ALWAYS:
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0008) << "\n" e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0008) << "\n"
<< "Target \"" << this->Target->GetName() << "\" links to item\n" << "Target \"" << this->Target->GetName() << "\" links to item\n"
<< " " << item << "\n" << " " << item << "\n"
<< "which is a full-path but not a valid library file name."; << "which is a full-path but not a valid library file name.";
/* clang-format on */
this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Target->GetBacktrace()); this->Target->GetBacktrace());
} }
@ -1629,6 +1635,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os) void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
{ {
// Tell the user what to do. // Tell the user what to do.
/* clang-format off */
os << "Policy CMP0003 should be set before this line. " os << "Policy CMP0003 should be set before this line. "
<< "Add code such as\n" << "Add code such as\n"
<< " if(COMMAND cmake_policy)\n" << " if(COMMAND cmake_policy)\n"
@ -1636,6 +1643,7 @@ void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
<< " endif(COMMAND cmake_policy)\n" << " endif(COMMAND cmake_policy)\n"
<< "as early as possible but after the most recent call to " << "as early as possible but after the most recent call to "
<< "cmake_minimum_required or cmake_policy(VERSION). "; << "cmake_minimum_required or cmake_policy(VERSION). ";
/* clang-format on */
// List the items that might need the old-style paths. // List the items that might need the old-style paths.
os << "This warning appears because target \"" os << "This warning appears because target \""

View File

@ -35,9 +35,11 @@ bool cmConfigureFileCommand
if(cmSystemTools::FileIsDirectory(this->InputFile)) if(cmSystemTools::FileIsDirectory(this->InputFile))
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "input location\n" e << "input location\n"
<< " " << this->InputFile << "\n" << " " << this->InputFile << "\n"
<< "is a directory but a file was expected."; << "is a directory but a file was expected.";
/* clang-format on */
this->SetError(e.str()); this->SetError(e.str());
return false; return false;
} }

View File

@ -307,9 +307,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
if (!fout) if (!fout)
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "Failed to open\n" e << "Failed to open\n"
<< " " << outFileName << "\n" << " " << outFileName << "\n"
<< cmSystemTools::GetLastSystemError(); << cmSystemTools::GetLastSystemError();
/* clang-format on */
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return -1; return -1;
} }
@ -369,11 +371,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
"CMAKE_POLICY_WARNING_CMP0056")) "CMAKE_POLICY_WARNING_CMP0056"))
{ {
std::ostringstream w; std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0056) << "\n" w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0056) << "\n"
"For compatibility with older versions of CMake, try_compile " "For compatibility with older versions of CMake, try_compile "
"is not honoring caller link flags (e.g. CMAKE_EXE_LINKER_FLAGS) " "is not honoring caller link flags (e.g. CMAKE_EXE_LINKER_FLAGS) "
"in the test project." "in the test project."
; ;
/* clang-format on */
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
} }
case cmPolicies::OLD: case cmPolicies::OLD:
@ -608,10 +612,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
copyFile)) copyFile))
{ {
std::ostringstream emsg; std::ostringstream emsg;
/* clang-format off */
emsg << "Cannot copy output executable\n" emsg << "Cannot copy output executable\n"
<< " '" << this->OutputFile << "'\n" << " '" << this->OutputFile << "'\n"
<< "to destination specified by COPY_FILE:\n" << "to destination specified by COPY_FILE:\n"
<< " '" << copyFile << "'\n"; << " '" << copyFile << "'\n";
/* clang-format on */
if(!this->FindErrorMessage.empty()) if(!this->FindErrorMessage.empty())
{ {
emsg << this->FindErrorMessage.c_str(); emsg << this->FindErrorMessage.c_str();

View File

@ -94,12 +94,14 @@ cmDocumentation::~cmDocumentation()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmDocumentation::PrintVersion(std::ostream& os) bool cmDocumentation::PrintVersion(std::ostream& os)
{ {
/* clang-format off */
os << os <<
this->GetNameString() << this->GetNameString() <<
" version " << cmVersion::GetCMakeVersion() << "\n" " version " << cmVersion::GetCMakeVersion() << "\n"
"\n" "\n"
"CMake suite maintained and supported by Kitware (kitware.com/cmake).\n" "CMake suite maintained and supported by Kitware (kitware.com/cmake).\n"
; ;
/* clang-format on */
return true; return true;
} }
@ -935,6 +937,7 @@ bool cmDocumentation::PrintOldCustomModules(std::ostream& os)
} }
else if((ext.length()==2) && (ext[1] >='1') && (ext[1]<='9')) else if((ext.length()==2) && (ext[1] >='1') && (ext[1]<='9'))
{ {
/* clang-format off */
os << os <<
".TH " << name << " " << ext[1] << " \"" << ".TH " << name << " " << ext[1] << " \"" <<
cmSystemTools::GetCurrentDateTime("%B %d, %Y") << cmSystemTools::GetCurrentDateTime("%B %d, %Y") <<
@ -947,6 +950,7 @@ bool cmDocumentation::PrintOldCustomModules(std::ostream& os)
".PP\n" << ".PP\n" <<
detail detail
; ;
/* clang-format on */
} }
else else
{ {

View File

@ -406,9 +406,11 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
else else
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "Cannot create package registry file:\n" e << "Cannot create package registry file:\n"
<< " " << fname << "\n" << " " << fname << "\n"
<< cmSystemTools::GetLastSystemError() << "\n"; << cmSystemTools::GetLastSystemError() << "\n";
/* clang-format on */
this->Makefile->IssueMessage(cmake::WARNING, e.str()); this->Makefile->IssueMessage(cmake::WARNING, e.str());
} }
} }

View File

@ -106,17 +106,21 @@ bool cmExportFileGenerator::GenerateImportFile()
std::ostream& os = *foutPtr; std::ostream& os = *foutPtr;
// Protect that file against use with older CMake versions. // Protect that file against use with older CMake versions.
/* clang-format off */
os << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; os << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n"
<< " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n"
<< "endif()\n"; << "endif()\n";
/* clang-format on */
// Isolate the file policy level. // Isolate the file policy level.
// We use 2.6 here instead of the current version because newer // 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 // versions of CMake should be able to export files imported by 2.6
// until the import format changes. // until the import format changes.
/* clang-format off */
os << "cmake_policy(PUSH)\n" os << "cmake_policy(PUSH)\n"
<< "cmake_policy(VERSION 2.6)\n"; << "cmake_policy(VERSION 2.6)\n";
/* clang-format on */
// Start with the import file header. // Start with the import file header.
this->GenerateImportHeaderCode(os); this->GenerateImportHeaderCode(os);
@ -197,10 +201,12 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os, void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os,
const char *versionString) const char *versionString)
{ {
/* clang-format off */
os << "if(CMAKE_VERSION VERSION_LESS " << versionString << ")\n" os << "if(CMAKE_VERSION VERSION_LESS " << versionString << ")\n"
" message(FATAL_ERROR \"This file relies on consumers using " " message(FATAL_ERROR \"This file relies on consumers using "
"CMake " << versionString << " or greater.\")\n" "CMake " << versionString << " or greater.\")\n"
"endif()\n\n"; "endif()\n\n";
/* clang-format on */
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -296,9 +302,11 @@ static bool checkInterfaceDirs(const std::string &prepro,
} }
if (!cmSystemTools::FileIsFullPath(li->c_str())) if (!cmSystemTools::FileIsFullPath(li->c_str()))
{ {
/* clang-format off */
e << "Target \"" << target->GetName() << "\" " << prop << e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains relative path:\n" " property contains relative path:\n"
" \"" << *li << "\""; " \"" << *li << "\"";
/* clang-format on */
target->GetLocalGenerator()->IssueMessage(messageType, e.str()); target->GetLocalGenerator()->IssueMessage(messageType, e.str());
} }
bool inBinary = isSubDirectory(li->c_str(), topBinaryDir); bool inBinary = isSubDirectory(li->c_str(), topBinaryDir);
@ -350,9 +358,11 @@ static bool checkInterfaceDirs(const std::string &prepro,
} }
if (inBinary) if (inBinary)
{ {
/* clang-format off */
e << "Target \"" << target->GetName() << "\" " << prop << e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains path:\n" " property contains path:\n"
" \"" << *li << "\"\nwhich is prefixed in the build directory."; " \"" << *li << "\"\nwhich is prefixed in the build directory.";
/* clang-format on */
target->GetLocalGenerator()->IssueMessage(messageType, e.str()); target->GetLocalGenerator()->IssueMessage(messageType, e.str());
} }
if (!inSourceBuild) if (!inSourceBuild)
@ -1016,15 +1026,18 @@ void cmExportFileGenerator::GenerateImportVersionCode(std::ostream& os)
{ {
// Store an import file format version. This will let us change the // Store an import file format version. This will let us change the
// format later while still allowing old import files to work. // format later while still allowing old import files to work.
/* clang-format off */
os << "# Commands may need to know the format version.\n" os << "# Commands may need to know the format version.\n"
<< "set(CMAKE_IMPORT_FILE_VERSION 1)\n" << "set(CMAKE_IMPORT_FILE_VERSION 1)\n"
<< "\n"; << "\n";
/* clang-format on */
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os, void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
const std::string &expectedTargets) const std::string &expectedTargets)
{ {
/* clang-format off */
os << "# Protect against multiple inclusion, which would fail when already " os << "# Protect against multiple inclusion, which would fail when already "
"imported targets are added once more.\n" "imported targets are added once more.\n"
"set(_targetsDefined)\n" "set(_targetsDefined)\n"
@ -1053,6 +1066,7 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
"unset(_targetsNotDefined)\n" "unset(_targetsNotDefined)\n"
"unset(_expectedTargets)\n" "unset(_expectedTargets)\n"
"\n\n"; "\n\n";
/* clang-format on */
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
@ -1163,15 +1177,19 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
{ {
if (missingTargets.empty()) if (missingTargets.empty())
{ {
/* clang-format off */
os << "# This file does not depend on other imported targets which have\n" os << "# This file does not depend on other imported targets which have\n"
"# been exported from the same project but in a separate " "# been exported from the same project but in a separate "
"export set.\n\n"; "export set.\n\n";
/* clang-format on */
return; return;
} }
/* clang-format off */
os << "# Make sure the targets which have been exported in some other \n" os << "# Make sure the targets which have been exported in some other \n"
"# export set exist.\n" "# export set exist.\n"
"unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n" "unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
"foreach(_target "; "foreach(_target ";
/* clang-format on */
std::set<std::string> emitted; std::set<std::string> emitted;
for(unsigned int i=0; i<missingTargets.size(); ++i) for(unsigned int i=0; i<missingTargets.size(); ++i)
{ {
@ -1180,6 +1198,7 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
os << "\"" << missingTargets[i] << "\" "; os << "\"" << missingTargets[i] << "\" ";
} }
} }
/* clang-format off */
os << ")\n" os << ")\n"
" if(NOT TARGET \"${_target}\" )\n" " if(NOT TARGET \"${_target}\" )\n"
" set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets \"" " set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets \""
@ -1203,6 +1222,7 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
"endif()\n" "endif()\n"
"unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n" "unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
"\n"; "\n";
/* clang-format on */
} }
@ -1217,6 +1237,7 @@ cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
// the non-development package, something similar happened to me without // the non-development package, something similar happened to me without
// on SUSE with a mysql pkg-config file, which claimed everything is fine, // on SUSE with a mysql pkg-config file, which claimed everything is fine,
// but the development package was not installed.). // but the development package was not installed.).
/* clang-format off */
os << "# Loop over all imported files and verify that they actually exist\n" os << "# Loop over all imported files and verify that they actually exist\n"
"foreach(target ${_IMPORT_CHECK_TARGETS} )\n" "foreach(target ${_IMPORT_CHECK_TARGETS} )\n"
" foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n" " foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n"
@ -1237,6 +1258,7 @@ cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
"endforeach()\n" "endforeach()\n"
"unset(_IMPORT_CHECK_TARGETS)\n" "unset(_IMPORT_CHECK_TARGETS)\n"
"\n"; "\n";
/* clang-format on */
} }

View File

@ -80,10 +80,12 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{ {
// The export file is being installed to an absolute path so the // The export file is being installed to an absolute path so the
// package is not relocatable. Use the configured install prefix. // package is not relocatable. Use the configured install prefix.
/* clang-format off */
os << os <<
"# The installation prefix configured by this project.\n" "# The installation prefix configured by this project.\n"
"set(_IMPORT_PREFIX \"" << installPrefix << "\")\n" "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n"
"\n"; "\n";
/* clang-format on */
} }
else else
{ {
@ -100,6 +102,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/")) cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/"))
{ {
// Handle "/usr move" symlinks created by some Linux distros. // Handle "/usr move" symlinks created by some Linux distros.
/* clang-format off */
os << os <<
"# Use original install prefix when loaded through a\n" "# Use original install prefix when loaded through a\n"
"# cross-prefix symbolic link such as /lib -> /usr/lib.\n" "# cross-prefix symbolic link such as /lib -> /usr/lib.\n"
@ -110,6 +113,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
"endif()\n" "endif()\n"
"unset(_realOrig)\n" "unset(_realOrig)\n"
"unset(_realCurr)\n"; "unset(_realCurr)\n";
/* clang-format on */
} }
std::string dest = expDest; std::string dest = expDest;
while(!dest.empty()) while(!dest.empty())
@ -214,6 +218,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
} }
// Now load per-configuration properties for them. // Now load per-configuration properties for them.
/* clang-format off */
os << "# Load information for each installed configuration.\n" os << "# Load information for each installed configuration.\n"
<< "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" << "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"
<< "file(GLOB CONFIG_FILES \"${_DIR}/" << "file(GLOB CONFIG_FILES \"${_DIR}/"
@ -222,11 +227,14 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
<< " include(${f})\n" << " include(${f})\n"
<< "endforeach()\n" << "endforeach()\n"
<< "\n"; << "\n";
/* clang-format on */
// Cleanup the import prefix variable. // Cleanup the import prefix variable.
/* clang-format off */
os << "# Cleanup temporary variables.\n" os << "# Cleanup temporary variables.\n"
<< "set(_IMPORT_PREFIX)\n" << "set(_IMPORT_PREFIX)\n"
<< "\n"; << "\n";
/* clang-format on */
this->GenerateImportedFileCheckLoop(os); this->GenerateImportedFileCheckLoop(os);
bool result = true; bool result = true;

View File

@ -569,10 +569,12 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
cmGeneratedFileStream fout(filename.c_str()); cmGeneratedFileStream fout(filename.c_str());
if(fout) if(fout)
{ {
/* clang-format off */
fout << "# This is a dummy file for the OBJECT library " fout << "# This is a dummy file for the OBJECT library "
<< target->GetName() << target->GetName()
<< " for the CMake CodeBlocks project generator.\n" << " for the CMake CodeBlocks project generator.\n"
<< "# Don't edit, this file will be overwritten.\n"; << "# Don't edit, this file will be overwritten.\n";
/* clang-format on */
} }
return filename; return filename;
} }

View File

@ -69,11 +69,13 @@ void cmExtraKateGenerator::CreateKateProjectFile(
return; return;
} }
/* clang-format off */
fout << fout <<
"{\n" "{\n"
"\t\"name\": \"" << this->ProjectName << "\",\n" "\t\"name\": \"" << this->ProjectName << "\",\n"
"\t\"directory\": \"" << lg->GetSourceDirectory() << "\",\n" "\t\"directory\": \"" << lg->GetSourceDirectory() << "\",\n"
"\t\"files\": [ { " << this->GenerateFilesString(lg) << "} ],\n"; "\t\"files\": [ { " << this->GenerateFilesString(lg) << "} ],\n";
/* clang-format on */
this->WriteTargets(lg, fout); this->WriteTargets(lg, fout);
fout << "}\n"; fout << "}\n";
} }
@ -89,11 +91,13 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
"CMAKE_KATE_MAKE_ARGUMENTS"); "CMAKE_KATE_MAKE_ARGUMENTS");
const char* homeOutputDir = lg->GetBinaryDirectory(); const char* homeOutputDir = lg->GetBinaryDirectory();
/* clang-format off */
fout << fout <<
"\t\"build\": {\n" "\t\"build\": {\n"
"\t\t\"directory\": \"" << lg->GetBinaryDirectory() << "\",\n" "\t\t\"directory\": \"" << lg->GetBinaryDirectory() << "\",\n"
"\t\t\"default_target\": \"all\",\n" "\t\t\"default_target\": \"all\",\n"
"\t\t\"clean_target\": \"clean\",\n"; "\t\t\"clean_target\": \"clean\",\n";
/* clang-format on */
// build, clean and quick are for the build plugin kate <= 4.12: // build, clean and quick are for the build plugin kate <= 4.12:
fout << "\t\t\"build\": \"" << make << " -C \\\"" << homeOutputDir fout << "\t\t\"build\": \"" << make << " -C \\\"" << homeOutputDir

View File

@ -2436,11 +2436,13 @@ cmFileCommand::HandleRPathChangeCommand(std::vector<std::string> const& args)
if(!cmSystemTools::ChangeRPath(file, oldRPath, newRPath, &emsg, &changed)) if(!cmSystemTools::ChangeRPath(file, oldRPath, newRPath, &emsg, &changed))
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "RPATH_CHANGE could not write new RPATH:\n" e << "RPATH_CHANGE could not write new RPATH:\n"
<< " " << newRPath << "\n" << " " << newRPath << "\n"
<< "to the file:\n" << "to the file:\n"
<< " " << file << "\n" << " " << file << "\n"
<< emsg; << emsg;
/* clang-format on */
this->SetError(e.str()); this->SetError(e.str());
success = false; success = false;
} }
@ -2511,9 +2513,11 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args)
if(!cmSystemTools::RemoveRPath(file, &emsg, &removed)) if(!cmSystemTools::RemoveRPath(file, &emsg, &removed))
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "RPATH_REMOVE could not remove RPATH from file:\n" e << "RPATH_REMOVE could not remove RPATH from file:\n"
<< " " << file << "\n" << " " << file << "\n"
<< emsg; << emsg;
/* clang-format on */
this->SetError(e.str()); this->SetError(e.str());
success = false; success = false;
} }
@ -2668,11 +2672,13 @@ bool cmFileCommand::HandleRename(std::vector<std::string> const& args)
{ {
std::string err = cmSystemTools::GetLastSystemError(); std::string err = cmSystemTools::GetLastSystemError();
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "RENAME failed to rename\n" e << "RENAME failed to rename\n"
<< " " << oldname << "\n" << " " << oldname << "\n"
<< "to\n" << "to\n"
<< " " << newname << "\n" << " " << newname << "\n"
<< "because: " << err << "\n"; << "because: " << err << "\n";
/* clang-format on */
this->SetError(e.str()); this->SetError(e.str());
return false; return false;
} }

View File

@ -748,10 +748,12 @@ bool cmFindPackageCommand::HandlePackageMode()
std::ostringstream aw; std::ostringstream aw;
if (configFileSetFOUNDFalse) if (configFileSetFOUNDFalse)
{ {
/* clang-format off */
e << "Found package configuration file:\n" e << "Found package configuration file:\n"
" " << this->FileFound << "\n" " " << this->FileFound << "\n"
"but it set " << foundVar << " to FALSE so package \"" << "but it set " << foundVar << " to FALSE so package \"" <<
this->Name << "\" is considered to be NOT FOUND."; this->Name << "\" is considered to be NOT FOUND.";
/* clang-format on */
if (!notFoundMessage.empty()) if (!notFoundMessage.empty())
{ {
e << " Reason given by package: \n" << notFoundMessage << "\n"; e << " Reason given by package: \n" << notFoundMessage << "\n";

View File

@ -118,9 +118,11 @@ void cmGeneratorExpressionDAGChecker::ReportError(
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "Error evaluating generator expression:\n" e << "Error evaluating generator expression:\n"
<< " " << expr << "\n" << " " << expr << "\n"
<< "Dependency loop found."; << "Dependency loop found.";
/* clang-format on */
context->LG->GetCMakeInstance() context->LG->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR, e.str(), ->IssueMessage(cmake::FATAL_ERROR, e.str(),
context->Backtrace); context->Backtrace);

View File

@ -1898,9 +1898,11 @@ void reportError(cmGeneratorExpressionContext *context,
} }
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "Error evaluating generator expression:\n" e << "Error evaluating generator expression:\n"
<< " " << expr << "\n" << " " << expr << "\n"
<< result; << result;
/* clang-format on */
context->LG->GetCMakeInstance() context->LG->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR, e.str(), ->IssueMessage(cmake::FATAL_ERROR, e.str(),
context->Backtrace); context->Backtrace);

View File

@ -2693,6 +2693,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
break; break;
} }
} }
/* clang-format off */
e << "Imported target \"" << targetName << "\" includes " e << "Imported target \"" << targetName << "\" includes "
"non-existent path\n \"" << *li << "\"\nin its " "non-existent path\n \"" << *li << "\"\nin its "
"INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n" "INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n"
@ -2702,6 +2703,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
"successfully.\n" "successfully.\n"
"* The installation package was faulty and references files it " "* The installation package was faulty and references files it "
"does not provide.\n"; "does not provide.\n";
/* clang-format on */
tgt->GetLocalGenerator()->IssueMessage(messageType, e.str()); tgt->GetLocalGenerator()->IssueMessage(messageType, e.str());
return; return;
} }
@ -2713,9 +2715,11 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
cmake::MessageType messageType = cmake::FATAL_ERROR; cmake::MessageType messageType = cmake::FATAL_ERROR;
if (!targetName.empty()) if (!targetName.empty())
{ {
/* clang-format off */
e << "Target \"" << targetName << "\" contains relative " e << "Target \"" << targetName << "\" contains relative "
"path in its INTERFACE_INCLUDE_DIRECTORIES:\n" "path in its INTERFACE_INCLUDE_DIRECTORIES:\n"
" \"" << *li << "\""; " \"" << *li << "\"";
/* clang-format on */
} }
else else
{ {
@ -5198,6 +5202,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
&& strcmp(newExplicitLibraries, explicitLibraries) != 0) && strcmp(newExplicitLibraries, explicitLibraries) != 0)
{ {
std::ostringstream w; std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n" w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
"Target \"" << this->GetName() << "\" has an " "Target \"" << this->GetName() << "\" has an "
"INTERFACE_LINK_LIBRARIES property which differs from its " << "INTERFACE_LINK_LIBRARIES property which differs from its " <<
@ -5207,6 +5212,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
" " << newExplicitLibraries << "\n" << " " << newExplicitLibraries << "\n" <<
linkIfaceProp << ":\n" linkIfaceProp << ":\n"
" " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n"; " " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n";
/* clang-format on */
this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str()); this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str());
this->PolicyWarnedCMP0022 = true; this->PolicyWarnedCMP0022 = true;
} }
@ -5269,6 +5275,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
{ newLibraries = "(empty)"; } { newLibraries = "(empty)"; }
std::ostringstream w; std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n" w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
"Target \"" << this->GetName() << "\" has an " "Target \"" << this->GetName() << "\" has an "
"INTERFACE_LINK_LIBRARIES property. " "INTERFACE_LINK_LIBRARIES property. "
@ -5281,6 +5288,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
" " << newLibraries << "\n" " " << newLibraries << "\n"
"Link implementation:\n" "Link implementation:\n"
" " << oldLibraries << "\n"; " " << oldLibraries << "\n";
/* clang-format on */
this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str()); this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str());
this->PolicyWarnedCMP0022 = true; this->PolicyWarnedCMP0022 = true;
} }
@ -5630,6 +5638,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles(
sep = "\n "; sep = "\n ";
} }
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "Target \"" << this->GetName() e << "Target \"" << this->GetName()
<< "\" has source files which vary by " << "\" has source files which vary by "
"configuration. This is not supported by the \"" "configuration. This is not supported by the \""
@ -5639,6 +5648,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles(
" " << firstConfigFiles << "\n" " " << firstConfigFiles << "\n"
"Config \"" << *it << "\":\n" "Config \"" << *it << "\":\n"
" " << thisConfigFiles << "\n"; " " << thisConfigFiles << "\n";
/* clang-format on */
this->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str()); this->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str());
return false; return false;
} }

View File

@ -111,12 +111,14 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p,
} }
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << e <<
"Generator\n" "Generator\n"
" " << this->GetName() << "\n" " " << this->GetName() << "\n"
"does not support platform specification, but platform\n" "does not support platform specification, but platform\n"
" " << p << "\n" " " << p << "\n"
"was specified."; "was specified.";
/* clang-format on */
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false; return false;
} }
@ -129,12 +131,14 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts,
return true; return true;
} }
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << e <<
"Generator\n" "Generator\n"
" " << this->GetName() << "\n" " " << this->GetName() << "\n"
"does not support toolset specification, but toolset\n" "does not support toolset specification, but toolset\n"
" " << ts << "\n" " " << ts << "\n"
"was specified."; "was specified.";
/* clang-format on */
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false; return false;
} }
@ -696,28 +700,34 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
if(!compilerFile || !*compilerFile || if(!compilerFile || !*compilerFile ||
cmSystemTools::IsNOTFOUND(compilerFile)) cmSystemTools::IsNOTFOUND(compilerFile))
{ {
/* clang-format off */
noCompiler << noCompiler <<
"No " << compilerName << " could be found.\n" "No " << compilerName << " could be found.\n"
; ;
/* clang-format on */
} }
else if(strcmp(lang, "RC") != 0 && else if(strcmp(lang, "RC") != 0 &&
strcmp(lang, "ASM_MASM") != 0) strcmp(lang, "ASM_MASM") != 0)
{ {
if(!cmSystemTools::FileIsFullPath(compilerFile)) if(!cmSystemTools::FileIsFullPath(compilerFile))
{ {
/* clang-format off */
noCompiler << noCompiler <<
"The " << compilerName << ":\n" "The " << compilerName << ":\n"
" " << compilerFile << "\n" " " << compilerFile << "\n"
"is not a full path and was not found in the PATH.\n" "is not a full path and was not found in the PATH.\n"
; ;
/* clang-format on */
} }
else if(!cmSystemTools::FileExists(compilerFile)) else if(!cmSystemTools::FileExists(compilerFile))
{ {
/* clang-format off */
noCompiler << noCompiler <<
"The " << compilerName << ":\n" "The " << compilerName << ":\n"
" " << compilerFile << "\n" " " << compilerFile << "\n"
"is not a full path to an existing compiler tool.\n" "is not a full path to an existing compiler tool.\n"
; ;
/* clang-format on */
} }
} }
if(!noCompiler.str().empty()) if(!noCompiler.str().empty())
@ -889,10 +899,12 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025")) mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025"))
{ {
std::ostringstream w; std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0025) << "\n" w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0025) << "\n"
"Converting " << lang << "Converting " << lang <<
" compiler id \"AppleClang\" to \"Clang\" for compatibility." " compiler id \"AppleClang\" to \"Clang\" for compatibility."
; ;
/* clang-format on */
mf->IssueMessage(cmake::AUTHOR_WARNING, w.str()); mf->IssueMessage(cmake::AUTHOR_WARNING, w.str());
} }
case cmPolicies::OLD: case cmPolicies::OLD:
@ -920,10 +932,12 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047")) mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047"))
{ {
std::ostringstream w; std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0047) << "\n" w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0047) << "\n"
"Converting " << lang << "Converting " << lang <<
" compiler id \"QCC\" to \"GNU\" for compatibility." " compiler id \"QCC\" to \"GNU\" for compatibility."
; ;
/* clang-format on */
mf->IssueMessage(cmake::AUTHOR_WARNING, w.str()); mf->IssueMessage(cmake::AUTHOR_WARNING, w.str());
} }
case cmPolicies::OLD: case cmPolicies::OLD:

View File

@ -55,11 +55,13 @@ void cmGlobalJOMMakefileGenerator::PrintCompilerAdvice(std::ostream& os,
{ {
if(lang == "CXX" || lang == "C") if(lang == "CXX" || lang == "C")
{ {
/* clang-format off */
os << os <<
"To use the JOM generator with Visual C++, cmake must be run from a " "To use the JOM generator with Visual C++, cmake must be run from a "
"shell that can use the compiler cl from the command line. This " "shell that can use the compiler cl from the command line. This "
"environment is unable to invoke the cl compiler. To fix this problem, " "environment is unable to invoke the cl compiler. To fix this problem, "
"run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n"; "run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n";
/* clang-format on */
} }
this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar); this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar);
} }

View File

@ -55,11 +55,13 @@ void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice(std::ostream& os,
{ {
if(lang == "CXX" || lang == "C") if(lang == "CXX" || lang == "C")
{ {
/* clang-format off */
os << os <<
"To use the NMake generator with Visual C++, cmake must be run from a " "To use the NMake generator with Visual C++, cmake must be run from a "
"shell that can use the compiler cl from the command line. This " "shell that can use the compiler cl from the command line. This "
"environment is unable to invoke the cl compiler. To fix this problem, " "environment is unable to invoke the cl compiler. To fix this problem, "
"run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n"; "run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n";
/* clang-format on */
} }
this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar); this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar);
} }

View File

@ -820,11 +820,13 @@ void cmGlobalNinjaGenerator::OpenRulesFileStream()
this->WriteDisclaimer(*this->RulesFileStream); this->WriteDisclaimer(*this->RulesFileStream);
// Write comment about this file. // Write comment about this file.
/* clang-format off */
*this->RulesFileStream *this->RulesFileStream
<< "# This file contains all the rules used to get the outputs files\n" << "# This file contains all the rules used to get the outputs files\n"
<< "# built from the input files.\n" << "# built from the input files.\n"
<< "# It is included in the main '" << NINJA_BUILD_FILE << "'.\n\n" << "# It is included in the main '" << NINJA_BUILD_FILE << "'.\n\n"
; ;
/* clang-format on */
} }
void cmGlobalNinjaGenerator::CloseRulesFileStream() void cmGlobalNinjaGenerator::CloseRulesFileStream()
@ -891,6 +893,7 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand(
} }
/* clang-format off */
*this->CompileCommandsStream << "\n{\n" *this->CompileCommandsStream << "\n{\n"
<< " \"directory\": \"" << " \"directory\": \""
<< cmGlobalGenerator::EscapeJSON(buildFileDir) << "\",\n" << cmGlobalGenerator::EscapeJSON(buildFileDir) << "\",\n"
@ -899,6 +902,7 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand(
<< " \"file\": \"" << " \"file\": \""
<< cmGlobalGenerator::EscapeJSON(sourceFileName) << "\"\n" << cmGlobalGenerator::EscapeJSON(sourceFileName) << "\"\n"
<< "}"; << "}";
/* clang-format on */
} }
void cmGlobalNinjaGenerator::CloseCompileCommandsStream() void cmGlobalNinjaGenerator::CloseCompileCommandsStream()
@ -1149,9 +1153,11 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
//dependencies that we have no rule for //dependencies that we have no rule for
cmGlobalNinjaGenerator::WriteDivider(os); cmGlobalNinjaGenerator::WriteDivider(os);
/* clang-format off */
os << "# Unknown Build Time Dependencies.\n" os << "# Unknown Build Time Dependencies.\n"
<< "# Tell Ninja that they may appear as side effects of build rules\n" << "# Tell Ninja that they may appear as side effects of build rules\n"
<< "# otherwise ordered by order-only dependencies.\n\n"; << "# otherwise ordered by order-only dependencies.\n\n";
/* clang-format on */
//get the list of files that cmake itself has generated as a //get the list of files that cmake itself has generated as a
//product of configuration. //product of configuration.
@ -1256,6 +1262,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
if (!warnExplicitDepends.empty()) if (!warnExplicitDepends.empty())
{ {
std::ostringstream w; std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0058) << "\n" w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0058) << "\n"
"This project specifies custom command DEPENDS on files " "This project specifies custom command DEPENDS on files "
"in the build tree that are not specified as the OUTPUT or " "in the build tree that are not specified as the OUTPUT or "
@ -1269,6 +1276,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
"Project authors should add the missing BYPRODUCTS or OUTPUT " "Project authors should add the missing BYPRODUCTS or OUTPUT "
"options to the custom commands that produce these files." "options to the custom commands that produce these files."
; ;
/* clang-format on */
this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str()); this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str());
} }
} }

View File

@ -337,6 +337,7 @@ void cmGlobalVisualStudio10Generator::Generate()
{ {
cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator(); cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator();
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << e <<
"The binary and/or source directory paths may be too long to generate " "The binary and/or source directory paths may be too long to generate "
"Visual Studio 10 files for this project. " "Visual Studio 10 files for this project. "
@ -356,6 +357,7 @@ void cmGlobalVisualStudio10Generator::Generate()
"the path length is too long for some internal buffer or API. " "the path length is too long for some internal buffer or API. "
"To avoid this problem CMake must use a full path for this file " "To avoid this problem CMake must use a full path for this file "
"which then triggers the VS 10 property dialog bug."; "which then triggers the VS 10 property dialog bug.";
/* clang-format on */
lg->IssueMessage(cmake::WARNING, e.str().c_str()); lg->IssueMessage(cmake::WARNING, e.str().c_str());
} }
} }
@ -566,9 +568,11 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
else else
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n" e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n"
<< "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n" << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n"
<< " http://msdn.microsoft.com/en-us/windows/bb980924.aspx"; << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx";
/* clang-format on */
mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
cmSystemTools::SetFatalErrorOccured(); cmSystemTools::SetFatalErrorOccured();
return false; return false;

View File

@ -204,6 +204,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
if(ui != this->UtilityDepends.end()) if(ui != this->UtilityDepends.end())
{ {
const char* uname = ui->second.c_str(); const char* uname = ui->second.c_str();
/* clang-format off */
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
<< uname << "\", \"" << uname << "\", \""
<< this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
@ -213,6 +214,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
<< "\t\t{" << guid << "} = {" << guid << "}\n" << "\t\t{" << guid << "} = {" << guid << "}\n"
<< "\tEndProjectSection\n" << "\tEndProjectSection\n"
<< "EndProject\n"; << "EndProject\n";
/* clang-format on */
} }
} }

View File

@ -704,6 +704,7 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
std::string guid = this->GetGUID(pname.c_str()); std::string guid = this->GetGUID(pname.c_str());
/* clang-format off */
fout << fout <<
"<?xml version=\"1.0\" encoding = \"" "<?xml version=\"1.0\" encoding = \""
<< this->Encoding() << "\"?>\n" << this->Encoding() << "\"?>\n"
@ -716,9 +717,11 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(
"\t<Platforms><Platform Name=\"Win32\"/></Platforms>\n" "\t<Platforms><Platform Name=\"Win32\"/></Platforms>\n"
"\t<Configurations>\n" "\t<Configurations>\n"
; ;
/* clang-format on */
for(std::vector<std::string>::iterator i = configs.begin(); for(std::vector<std::string>::iterator i = configs.begin();
i != configs.end(); ++i) i != configs.end(); ++i)
{ {
/* clang-format off */
fout << fout <<
"\t\t<Configuration\n" "\t\t<Configuration\n"
"\t\t\tName=\"" << *i << "|Win32\"\n" "\t\t\tName=\"" << *i << "|Win32\"\n"
@ -730,13 +733,16 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(
"\t\t\tCharacterSet=\"2\">\n" "\t\t\tCharacterSet=\"2\">\n"
"\t\t</Configuration>\n" "\t\t</Configuration>\n"
; ;
/* clang-format on */
} }
/* clang-format off */
fout << fout <<
"\t</Configurations>\n" "\t</Configurations>\n"
"\t<Files></Files>\n" "\t<Files></Files>\n"
"\t<Globals></Globals>\n" "\t<Globals></Globals>\n"
"</VisualStudioProject>\n" "</VisualStudioProject>\n"
; ;
/* clang-format on */
if(fout.Close()) if(fout.Close())
{ {

View File

@ -3655,6 +3655,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
makefileStream.SetCopyIfDifferent(true); makefileStream.SetCopyIfDifferent(true);
// one more pass for external depend information not handled // one more pass for external depend information not handled
// correctly by xcode // correctly by xcode
/* clang-format off */
makefileStream << "# DO NOT EDIT\n"; makefileStream << "# DO NOT EDIT\n";
makefileStream << "# This makefile makes sure all linkable targets are\n"; makefileStream << "# This makefile makes sure all linkable targets are\n";
makefileStream << "# up-to-date with anything they link to\n" makefileStream << "# up-to-date with anything they link to\n"
@ -3664,6 +3665,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
makefileStream makefileStream
<< "# For each target create a dummy rule " << "# For each target create a dummy rule "
"so the target does not have to exist\n"; "so the target does not have to exist\n";
/* clang-format on */
std::set<std::string> emitted; std::set<std::string> emitted;
for(std::vector<cmXCodeObject*>::iterator i = targets.begin(); for(std::vector<cmXCodeObject*>::iterator i = targets.begin();
i != targets.end(); ++i) i != targets.end(); ++i)
@ -3688,10 +3690,12 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
makefileStream << "\n\n"; makefileStream << "\n\n";
// Write rules to help Xcode relink things at the right time. // Write rules to help Xcode relink things at the right time.
/* clang-format off */
makefileStream << makefileStream <<
"# Rules to remove targets that are older than anything to which they\n" "# Rules to remove targets that are older than anything to which they\n"
"# link. This forces Xcode to relink the targets from scratch. It\n" "# link. This forces Xcode to relink the targets from scratch. It\n"
"# does not seem to check these dependencies itself.\n"; "# does not seem to check these dependencies itself.\n";
/* clang-format on */
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
ct = this->CurrentConfigurationTypes.begin(); ct = this->CurrentConfigurationTypes.begin();
ct != this->CurrentConfigurationTypes.end(); ++ct) ct != this->CurrentConfigurationTypes.end(); ++ct)

View File

@ -216,6 +216,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
Indent indentN = indent.Next(); Indent indentN = indent.Next();
Indent indentNN = indentN.Next(); Indent indentNN = indentN.Next();
Indent indentNNN = indentNN.Next(); Indent indentNNN = indentNN.Next();
/* clang-format off */
os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n" os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n"
<< indentN << " \"" << installedFile << "\"\n" << indentN << " \"" << installedFile << "\"\n"
<< indentN << " \"" << this->MainImportFile << "\")\n"; << indentN << " \"" << this->MainImportFile << "\")\n";
@ -229,6 +230,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
os << indentNN << "endif()\n"; os << indentNN << "endif()\n";
os << indentN << "endif()\n"; os << indentN << "endif()\n";
os << indent << "endif()\n"; os << indent << "endif()\n";
/* clang-format on */
// Install the main export file. // Install the main export file.
std::vector<std::string> files; std::vector<std::string> files;

View File

@ -685,9 +685,11 @@ cmInstallTargetGenerator
// Write a rule to remove the installed file if its rpath is not the // Write a rule to remove the installed file if its rpath is not the
// new rpath. This is needed for existing build/install trees when // new rpath. This is needed for existing build/install trees when
// the installed rpath changes but the file is not rebuilt. // the installed rpath changes but the file is not rebuilt.
/* clang-format off */
os << indent << "file(RPATH_CHECK\n" os << indent << "file(RPATH_CHECK\n"
<< indent << " FILE \"" << toDestDirPath << "\"\n" << indent << " FILE \"" << toDestDirPath << "\"\n"
<< indent << " RPATH \"" << newRpath << "\")\n"; << indent << " RPATH \"" << newRpath << "\")\n";
/* clang-format on */
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -37,9 +37,11 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir)
{ {
bool convertToAbsolute = false; bool convertToAbsolute = false;
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "This command specifies the relative path\n" e << "This command specifies the relative path\n"
<< " " << unixPath << "\n" << " " << unixPath << "\n"
<< "as a link directory.\n"; << "as a link directory.\n";
/* clang-format on */
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015)) switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015))
{ {
case cmPolicies::WARN: case cmPolicies::WARN:

View File

@ -261,9 +261,11 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
if(!token) if(!token)
{ {
std::ostringstream error; std::ostringstream error;
/* clang-format off */
error << "Error in cmake code at\n" << this->FileName << ":" error << "Error in cmake code at\n" << this->FileName << ":"
<< cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n" << cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n"
<< "Parse error. Function missing opening \"(\"."; << "Parse error. Function missing opening \"(\".";
/* clang-format on */
cmSystemTools::Error(error.str().c_str()); cmSystemTools::Error(error.str().c_str());
return false; return false;
} }
@ -382,10 +384,12 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
bool isError = (this->Separation == SeparationError || bool isError = (this->Separation == SeparationError ||
delim == cmListFileArgument::Bracket); delim == cmListFileArgument::Bracket);
std::ostringstream m; std::ostringstream m;
/* clang-format off */
m << "Syntax " << (isError? "Error":"Warning") << " in cmake code at\n" m << "Syntax " << (isError? "Error":"Warning") << " in cmake code at\n"
<< " " << this->FileName << ":" << token->line << ":" << " " << this->FileName << ":" << token->line << ":"
<< token->column << "\n" << token->column << "\n"
<< "Argument not separated from preceding token by whitespace."; << "Argument not separated from preceding token by whitespace.";
/* clang-format on */
if(isError) if(isError)
{ {
this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str()); this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str());

View File

@ -349,6 +349,7 @@ void cmLocalGenerator::GenerateInstallRules()
<< std::endl; << std::endl;
// Write support code for generating per-configuration install rules. // Write support code for generating per-configuration install rules.
/* clang-format off */
fout << fout <<
"# Set the install configuration name.\n" "# Set the install configuration name.\n"
"if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" "if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n"
@ -362,8 +363,10 @@ void cmLocalGenerator::GenerateInstallRules()
"\\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n" "\\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n"
"endif()\n" "endif()\n"
"\n"; "\n";
/* clang-format on */
// Write support code for dealing with component-specific installs. // Write support code for dealing with component-specific installs.
/* clang-format off */
fout << fout <<
"# Set the component getting installed.\n" "# Set the component getting installed.\n"
"if(NOT CMAKE_INSTALL_COMPONENT)\n" "if(NOT CMAKE_INSTALL_COMPONENT)\n"
@ -375,17 +378,20 @@ void cmLocalGenerator::GenerateInstallRules()
" endif()\n" " endif()\n"
"endif()\n" "endif()\n"
"\n"; "\n";
/* clang-format on */
// Copy user-specified install options to the install code. // Copy user-specified install options to the install code.
if(const char* so_no_exe = if(const char* so_no_exe =
this->Makefile->GetDefinition("CMAKE_INSTALL_SO_NO_EXE")) this->Makefile->GetDefinition("CMAKE_INSTALL_SO_NO_EXE"))
{ {
/* clang-format off */
fout << fout <<
"# Install shared libraries without execute permission?\n" "# Install shared libraries without execute permission?\n"
"if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" "if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n"
" set(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n" " set(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n"
"endif()\n" "endif()\n"
"\n"; "\n";
/* clang-format on */
} }
// Ask each install generator to write its code. // Ask each install generator to write its code.
@ -426,6 +432,7 @@ void cmLocalGenerator::GenerateInstallRules()
// Record the install manifest. // Record the install manifest.
if ( toplevel_install ) if ( toplevel_install )
{ {
/* clang-format off */
fout << fout <<
"if(CMAKE_INSTALL_COMPONENT)\n" "if(CMAKE_INSTALL_COMPONENT)\n"
" set(CMAKE_INSTALL_MANIFEST \"install_manifest_" " set(CMAKE_INSTALL_MANIFEST \"install_manifest_"
@ -438,6 +445,7 @@ void cmLocalGenerator::GenerateInstallRules()
" \"${CMAKE_INSTALL_MANIFEST_FILES}\")\n" " \"${CMAKE_INSTALL_MANIFEST_FILES}\")\n"
"file(WRITE \"" << homedir << "/${CMAKE_INSTALL_MANIFEST}\"\n" "file(WRITE \"" << homedir << "/${CMAKE_INSTALL_MANIFEST}\"\n"
" \"${CMAKE_INSTALL_MANIFEST_CONTENT}\")\n"; " \"${CMAKE_INSTALL_MANIFEST_CONTENT}\")\n";
/* clang-format on */
} }
} }
@ -1594,10 +1602,12 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
"CMAKE_POLICY_WARNING_CMP0065")) "CMAKE_POLICY_WARNING_CMP0065"))
{ {
std::ostringstream w; std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0065) << "\n" w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0065) << "\n"
"For compatibility with older versions of CMake, " "For compatibility with older versions of CMake, "
"additional flags may be added to export symbols on all " "additional flags may be added to export symbols on all "
"executables regardless of thier ENABLE_EXPORTS property."; "executables regardless of thier ENABLE_EXPORTS property.";
/* clang-format on */
this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); this->IssueMessage(cmake::AUTHOR_WARNING, w.str());
} }
case cmPolicies::OLD: case cmPolicies::OLD:
@ -2176,6 +2186,7 @@ void cmLocalGenerator
this->WarnCMP0063.insert(target).second) this->WarnCMP0063.insert(target).second)
{ {
std::ostringstream w; std::ostringstream w;
/* clang-format off */
w << w <<
cmPolicies::GetPolicyWarning(cmPolicies::CMP0063) << "\n" cmPolicies::GetPolicyWarning(cmPolicies::CMP0063) << "\n"
"Target \"" << target->GetName() << "\" of " "Target \"" << target->GetName() << "\" of "
@ -2183,6 +2194,7 @@ void cmLocalGenerator
"has the following visibility properties set for " << lang << ":\n" << "has the following visibility properties set for " << lang << ":\n" <<
warnCMP0063 << warnCMP0063 <<
"For compatibility CMake is not honoring them for this target."; "For compatibility CMake is not honoring them for this target.";
/* clang-format on */
target->GetLocalGenerator()->GetCMakeInstance() target->GetLocalGenerator()->GetCMakeInstance()
->IssueMessage(cmake::AUTHOR_WARNING, w.str(), ->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
target->GetBacktrace()); target->GetBacktrace());
@ -2764,6 +2776,7 @@ cmLocalGenerator
if(this->ObjectMaxPathViolations.insert(dir_max).second) if(this->ObjectMaxPathViolations.insert(dir_max).second)
{ {
std::ostringstream m; std::ostringstream m;
/* clang-format off */
m << "The object file directory\n" m << "The object file directory\n"
<< " " << dir_max << "\n" << " " << dir_max << "\n"
<< "has " << dir_max.size() << " characters. " << "has " << dir_max.size() << " characters. "
@ -2774,6 +2787,7 @@ cmLocalGenerator
<< " " << ssin << "\n" << " " << ssin << "\n"
<< "cannot be safely placed under this directory. " << "cannot be safely placed under this directory. "
<< "The build may not work correctly."; << "The build may not work correctly.";
/* clang-format on */
this->IssueMessage(cmake::WARNING, m.str()); this->IssueMessage(cmake::WARNING, m.str());
} }
} }
@ -3034,11 +3048,13 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
if (define[pos] == '(') if (define[pos] == '(')
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "WARNING: Function-style preprocessor definitions may not be " e << "WARNING: Function-style preprocessor definitions may not be "
<< "passed on the compiler command line because many compilers " << "passed on the compiler command line because many compilers "
<< "do not support it.\n" << "do not support it.\n"
<< "CMake is dropping a preprocessor definition: " << define << "\n" << "CMake is dropping a preprocessor definition: " << define << "\n"
<< "Consider defining the macro in a (configured) header file.\n"; << "Consider defining the macro in a (configured) header file.\n";
/* clang-format on */
cmSystemTools::Message(e.str().c_str()); cmSystemTools::Message(e.str().c_str());
return false; return false;
} }
@ -3048,11 +3064,13 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
if(define.find_first_of("#") != define.npos) if(define.find_first_of("#") != define.npos)
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "WARNING: Preprocessor definitions containing '#' may not be " e << "WARNING: Preprocessor definitions containing '#' may not be "
<< "passed on the compiler command line because many compilers " << "passed on the compiler command line because many compilers "
<< "do not support it.\n" << "do not support it.\n"
<< "CMake is dropping a preprocessor definition: " << define << "\n" << "CMake is dropping a preprocessor definition: " << define << "\n"
<< "Consider defining the macro in a (configured) header file.\n"; << "Consider defining the macro in a (configured) header file.\n";
/* clang-format on */
cmSystemTools::Message(e.str().c_str()); cmSystemTools::Message(e.str().c_str());
return false; return false;
} }

View File

@ -519,6 +519,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
this->WriteDisclaimer(infoFileStream); this->WriteDisclaimer(infoFileStream);
// Setup relative path conversion tops. // Setup relative path conversion tops.
/* clang-format off */
infoFileStream infoFileStream
<< "# Relative path conversion top directories.\n" << "# Relative path conversion top directories.\n"
<< "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \""
@ -528,14 +529,17 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
<< this->StateSnapshot.GetDirectory().GetRelativePathTopBinary() << this->StateSnapshot.GetDirectory().GetRelativePathTopBinary()
<< "\")\n" << "\")\n"
<< "\n"; << "\n";
/* clang-format on */
// Tell the dependency scanner to use unix paths if necessary. // Tell the dependency scanner to use unix paths if necessary.
if(cmSystemTools::GetForceUnixPaths()) if(cmSystemTools::GetForceUnixPaths())
{ {
/* clang-format off */
infoFileStream infoFileStream
<< "# Force unix paths in dependencies.\n" << "# Force unix paths in dependencies.\n"
<< "set(CMAKE_FORCE_UNIX_PATHS 1)\n" << "set(CMAKE_FORCE_UNIX_PATHS 1)\n"
<< "\n"; << "\n";
/* clang-format on */
} }
// Store the include regular expressions for this directory. // Store the include regular expressions for this directory.
@ -718,13 +722,16 @@ cmLocalUnixMakefileGenerator3
else else
{ {
#if !defined(__VMS) #if !defined(__VMS)
/* clang-format off */
makefileStream makefileStream
<< "# The shell in which to execute make rules.\n" << "# The shell in which to execute make rules.\n"
<< "SHELL = /bin/sh\n" << "SHELL = /bin/sh\n"
<< "\n"; << "\n";
/* clang-format on */
#endif #endif
} }
/* clang-format off */
makefileStream makefileStream
<< "# The CMake executable.\n" << "# The CMake executable.\n"
<< "CMAKE_COMMAND = " << "CMAKE_COMMAND = "
@ -753,6 +760,7 @@ cmLocalUnixMakefileGenerator3
<< this->Convert(this->GetBinaryDirectory(), FULL, SHELL) << this->Convert(this->GetBinaryDirectory(), FULL, SHELL)
<< "\n" << "\n"
<< "\n"; << "\n";
/* clang-format on */
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -793,27 +801,33 @@ cmLocalUnixMakefileGenerator3
// Switch on WMake feature, if an error or interrupt occurs during // Switch on WMake feature, if an error or interrupt occurs during
// makefile processing, the current target being made may be deleted // makefile processing, the current target being made may be deleted
// without prompting (the same as command line -e option). // without prompting (the same as command line -e option).
/* clang-format off */
makefileStream << makefileStream <<
"\n" "\n"
".ERASE\n" ".ERASE\n"
"\n" "\n"
; ;
/* clang-format on */
} }
if(this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) if(this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
{ {
/* clang-format off */
makefileStream makefileStream
<< "# Produce verbose output by default.\n" << "# Produce verbose output by default.\n"
<< "VERBOSE = 1\n" << "VERBOSE = 1\n"
<< "\n"; << "\n";
/* clang-format on */
} }
if(this->IsWatcomWMake()) if(this->IsWatcomWMake())
{ {
/* clang-format off */
makefileStream << makefileStream <<
"!ifndef VERBOSE\n" "!ifndef VERBOSE\n"
".SILENT\n" ".SILENT\n"
"!endif\n" "!endif\n"
"\n" "\n"
; ;
/* clang-format on */
} }
else else
{ {
@ -1252,12 +1266,14 @@ cmLocalUnixMakefileGenerator3
std::set<std::string> languages; std::set<std::string> languages;
target->GetLanguages(languages, target->GetLanguages(languages,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
/* clang-format off */
fout << "\n" fout << "\n"
<< "# Per-language clean rules from dependency scanning.\n" << "# Per-language clean rules from dependency scanning.\n"
<< "foreach(lang " << cmJoin(languages, " ") << ")\n" << "foreach(lang " << cmJoin(languages, " ") << ")\n"
<< " include(" << this->GetTargetDirectory(target) << " include(" << this->GetTargetDirectory(target)
<< "/cmake_clean_${lang}.cmake OPTIONAL)\n" << "/cmake_clean_${lang}.cmake OPTIONAL)\n"
<< "endforeach()\n"; << "endforeach()\n";
/* clang-format on */
} }
} }
@ -2083,10 +2099,12 @@ void cmLocalUnixMakefileGenerator3
this->ConfigName, l->first); this->ConfigName, l->first);
if(!defines.empty()) if(!defines.empty())
{ {
/* clang-format off */
cmakefileStream cmakefileStream
<< "\n" << "\n"
<< "# Preprocessor definitions for this target.\n" << "# Preprocessor definitions for this target.\n"
<< "set(CMAKE_TARGET_DEFINITIONS_" << l->first << "\n"; << "set(CMAKE_TARGET_DEFINITIONS_" << l->first << "\n";
/* clang-format on */
for(std::set<std::string>::const_iterator di = defines.begin(); for(std::set<std::string>::const_iterator di = defines.begin();
di != defines.end(); ++di) di != defines.end(); ++di)
{ {

View File

@ -794,16 +794,20 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
std::string const& outDir = std::string const& outDir =
target->GetType() == cmState::OBJECT_LIBRARY? target->GetType() == cmState::OBJECT_LIBRARY?
intermediateDir : target->GetDirectory(configName); intermediateDir : target->GetDirectory(configName);
/* clang-format off */
fout << "\t\t\tOutputDirectory=\"" fout << "\t\t\tOutputDirectory=\""
<< this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n"; << this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n";
/* clang-format on */
} }
/* clang-format off */
fout << "\t\t\tIntermediateDirectory=\"" fout << "\t\t\tIntermediateDirectory=\""
<< this->ConvertToXMLOutputPath(intermediateDir.c_str()) << this->ConvertToXMLOutputPath(intermediateDir.c_str())
<< "\"\n" << "\"\n"
<< "\t\t\tConfigurationType=\"" << configType << "\"\n" << "\t\t\tConfigurationType=\"" << configType << "\"\n"
<< "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n"
<< "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"false\"\n"; << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"false\"\n";
/* clang-format on */
if (this->FortranProject) if (this->FortranProject)
{ {
@ -813,10 +817,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
std::string targetExt = std::string targetExt =
cmSystemTools::GetFilenameLastExtension(targetNameFull); cmSystemTools::GetFilenameLastExtension(targetNameFull);
/* clang-format off */
fout << fout <<
"\t\t\tTargetName=\"" << this->EscapeForXML(targetName) << "\"\n" "\t\t\tTargetName=\"" << this->EscapeForXML(targetName) << "\"\n"
"\t\t\tTargetExt=\"" << this->EscapeForXML(targetExt) << "\"\n" "\t\t\tTargetExt=\"" << this->EscapeForXML(targetExt) << "\"\n"
; ;
/* clang-format on */
} }
// If unicode is enabled change the character set to unicode, if not // If unicode is enabled change the character set to unicode, if not
@ -898,11 +904,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
if(gg->IsMasmEnabled() && !this->FortranProject) if(gg->IsMasmEnabled() && !this->FortranProject)
{ {
Options masmOptions(this, Options::MasmCompiler, 0, 0); Options masmOptions(this, Options::MasmCompiler, 0, 0);
/* clang-format off */
fout << fout <<
"\t\t\t<Tool\n" "\t\t\t<Tool\n"
"\t\t\t\tName=\"MASM\"\n" "\t\t\t\tName=\"MASM\"\n"
"\t\t\t\tIncludePaths=\"" "\t\t\t\tIncludePaths=\""
; ;
/* clang-format on */
const char* sep = ""; const char* sep = "";
for(i = includes.begin(); i != includes.end(); ++i) for(i = includes.begin(); i != includes.end(); ++i)
{ {
@ -916,9 +924,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n",
"ASM_MASM"); "ASM_MASM");
masmOptions.OutputFlagMap(fout, "\t\t\t\t"); masmOptions.OutputFlagMap(fout, "\t\t\t\t");
/* clang-format off */
fout << fout <<
"\t\t\t\tObjectFile=\"$(IntDir)\\\"\n" "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"
"\t\t\t/>\n"; "\t\t\t/>\n";
/* clang-format on */
} }
tool = "VCCustomBuildTool"; tool = "VCCustomBuildTool";
if(this->FortranProject) if(this->FortranProject)
@ -985,9 +995,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
{ {
manifestTool = "VFManifestTool"; manifestTool = "VFManifestTool";
} }
/* clang-format off */
fout << fout <<
"\t\t\t<Tool\n" "\t\t\t<Tool\n"
"\t\t\t\tName=\"" << manifestTool << "\""; "\t\t\t\tName=\"" << manifestTool << "\"";
/* clang-format on */
std::vector<cmSourceFile const*> manifest_srcs; std::vector<cmSourceFile const*> manifest_srcs;
target->GetManifests(manifest_srcs, configName); target->GetManifests(manifest_srcs, configName);
@ -1388,6 +1400,7 @@ void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool(
{ {
if (const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY")) if (const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY"))
{ {
/* clang-format off */
fout << fout <<
"\t\t\t<DeploymentTool\n" "\t\t\t<DeploymentTool\n"
"\t\t\t\tForceDirty=\"-1\"\n" "\t\t\t\tForceDirty=\"-1\"\n"
@ -1395,14 +1408,17 @@ void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool(
"\t\t\t\tRegisterOutput=\"0\"\n" "\t\t\t\tRegisterOutput=\"0\"\n"
"\t\t\t\tAdditionalFiles=\"\"/>\n" "\t\t\t\tAdditionalFiles=\"\"/>\n"
; ;
/* clang-format on */
std::string const exe = std::string const exe =
dir + std::string("\\") + target->GetFullName(config); dir + std::string("\\") + target->GetFullName(config);
/* clang-format off */
fout << fout <<
"\t\t\t<DebuggerTool\n" "\t\t\t<DebuggerTool\n"
"\t\t\t\tRemoteExecutable=\"" << this->EscapeForXML(exe) << "\"\n" "\t\t\t\tRemoteExecutable=\"" << this->EscapeForXML(exe) << "\"\n"
"\t\t\t\tArguments=\"\"\n" "\t\t\t\tArguments=\"\"\n"
"\t\t\t/>\n" "\t\t\t/>\n"
; ;
/* clang-format on */
} }
} }
} }
@ -1961,6 +1977,7 @@ WriteCustomRule(std::ostream& fout,
{ {
cmSystemTools::ReplaceString(script, "$(Configuration)", i->c_str()); cmSystemTools::ReplaceString(script, "$(Configuration)", i->c_str());
} }
/* clang-format off */
fout << "\t\t\t\t\t<Tool\n" fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << customTool << "\"\n" << "\t\t\t\t\tName=\"" << customTool << "\"\n"
<< "\t\t\t\t\tDescription=\"" << "\t\t\t\t\tDescription=\""
@ -1968,6 +1985,7 @@ WriteCustomRule(std::ostream& fout,
<< "\t\t\t\t\tCommandLine=\"" << "\t\t\t\t\tCommandLine=\""
<< this->EscapeForXML(script.c_str()) << "\"\n" << this->EscapeForXML(script.c_str()) << "\"\n"
<< "\t\t\t\t\tAdditionalDependencies=\""; << "\t\t\t\t\tAdditionalDependencies=\"";
/* clang-format on */
if(ccg.GetDepends().empty()) if(ccg.GetDepends().empty())
{ {
// There are no real dependencies. Produce an artificial one to // There are no real dependencies. Produce an artificial one to
@ -2025,9 +2043,11 @@ void cmLocalVisualStudio7Generator::WriteVCProjBeginGroup(std::ostream& fout,
const char* group, const char* group,
const char* ) const char* )
{ {
/* clang-format off */
fout << "\t\t<Filter\n" fout << "\t\t<Filter\n"
<< "\t\t\tName=\"" << group << "\"\n" << "\t\t\tName=\"" << group << "\"\n"
<< "\t\t\tFilter=\"\">\n"; << "\t\t\tFilter=\"\">\n";
/* clang-format on */
} }
@ -2107,9 +2127,11 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout,
if(vsProvider && vsLocalpath && vsProjectname) if(vsProvider && vsLocalpath && vsProjectname)
{ {
/* clang-format off */
fout << "\tSccProjectName=\"" << vsProjectname << "\"\n" fout << "\tSccProjectName=\"" << vsProjectname << "\"\n"
<< "\tSccLocalPath=\"" << vsLocalpath << "\"\n" << "\tSccLocalPath=\"" << vsLocalpath << "\"\n"
<< "\tSccProvider=\"" << vsProvider << "\"\n"; << "\tSccProvider=\"" << vsProvider << "\"\n";
/* clang-format on */
const char* vsAuxPath = target->GetProperty("VS_SCC_AUXPATH"); const char* vsAuxPath = target->GetProperty("VS_SCC_AUXPATH");
if(vsAuxPath) if(vsAuxPath)
@ -2128,11 +2150,13 @@ cmLocalVisualStudio7Generator
cmGlobalVisualStudio7Generator* gg = cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
/* clang-format off */
fout << "<?xml version=\"1.0\" encoding = \"" fout << "<?xml version=\"1.0\" encoding = \""
<< gg->Encoding() << "\"?>\n" << gg->Encoding() << "\"?>\n"
<< "<VisualStudioProject\n" << "<VisualStudioProject\n"
<< "\tProjectCreator=\"Intel Fortran\"\n" << "\tProjectCreator=\"Intel Fortran\"\n"
<< "\tVersion=\"" << gg->GetIntelProjectVersion() << "\"\n"; << "\tVersion=\"" << gg->GetIntelProjectVersion() << "\"\n";
/* clang-format on */
const char* keyword = target->GetProperty("VS_KEYWORD"); const char* keyword = target->GetProperty("VS_KEYWORD");
if(!keyword) if(!keyword)
{ {
@ -2173,11 +2197,13 @@ cmLocalVisualStudio7Generator
fout << "\tProjectType=\"" << projectType << "\"\n"; fout << "\tProjectType=\"" << projectType << "\"\n";
} }
this->WriteProjectSCC(fout, target); this->WriteProjectSCC(fout, target);
/* clang-format off */
fout<< "\tKeyword=\"" << keyword << "\">\n" fout<< "\tKeyword=\"" << keyword << "\">\n"
<< "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n"
<< "\t<Platforms>\n" << "\t<Platforms>\n"
<< "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n" << "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n"
<< "\t</Platforms>\n"; << "\t</Platforms>\n";
/* clang-format on */
} }
@ -2196,10 +2222,12 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
cmGlobalVisualStudio7Generator* gg = cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
/* clang-format off */
fout << "<?xml version=\"1.0\" encoding = \"" fout << "<?xml version=\"1.0\" encoding = \""
<< gg->Encoding() << "\"?>\n" << gg->Encoding() << "\"?>\n"
<< "<VisualStudioProject\n" << "<VisualStudioProject\n"
<< "\tProjectType=\"Visual C++\"\n"; << "\tProjectType=\"Visual C++\"\n";
/* clang-format on */
if(gg->GetVersion() == cmGlobalVisualStudioGenerator::VS71) if(gg->GetVersion() == cmGlobalVisualStudioGenerator::VS71)
{ {
fout << "\tVersion=\"7.10\"\n"; fout << "\tVersion=\"7.10\"\n";
@ -2229,12 +2257,15 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
{ {
fout << "\tTargetFrameworkVersion=\"" << targetFrameworkVersion << "\"\n"; fout << "\tTargetFrameworkVersion=\"" << targetFrameworkVersion << "\"\n";
} }
/* clang-format off */
fout << "\tKeyword=\"" << keyword << "\">\n" fout << "\tKeyword=\"" << keyword << "\">\n"
<< "\t<Platforms>\n" << "\t<Platforms>\n"
<< "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n" << "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n"
<< "\t</Platforms>\n"; << "\t</Platforms>\n";
/* clang-format on */
if(gg->IsMasmEnabled()) if(gg->IsMasmEnabled())
{ {
/* clang-format off */
fout << fout <<
"\t<ToolFiles>\n" "\t<ToolFiles>\n"
"\t\t<DefaultToolFile\n" "\t\t<DefaultToolFile\n"
@ -2242,6 +2273,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
"\t\t/>\n" "\t\t/>\n"
"\t</ToolFiles>\n" "\t</ToolFiles>\n"
; ;
/* clang-format on */
} }
} }
@ -2261,10 +2293,12 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(
std::string name = i->substr(10); std::string name = i->substr(10);
if(name != "") if(name != "")
{ {
/* clang-format off */
fout << "\t\t<Global\n" fout << "\t\t<Global\n"
<< "\t\t\tName=\"" << name << "\"\n" << "\t\t\tName=\"" << name << "\"\n"
<< "\t\t\tValue=\"" << target->GetProperty(*i) << "\"\n" << "\t\t\tValue=\"" << target->GetProperty(*i) << "\"\n"
<< "\t\t/>\n"; << "\t\t/>\n";
/* clang-format on */
} }
} }
} }

View File

@ -433,10 +433,12 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_ALWAYS:
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n"
<< "The included script\n " << "The included script\n "
<< this->Makefile->GetExecutionFilePath() << "\n" << this->Makefile->GetExecutionFilePath() << "\n"
<< "affects policy settings, so it requires this policy to be set."; << "affects policy settings, so it requires this policy to be set.";
/* clang-format on */
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
} }
break; break;
@ -1652,19 +1654,23 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile *mf)
{ {
// The file is missing. Check policy CMP0014. // The file is missing. Check policy CMP0014.
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "The source directory\n" e << "The source directory\n"
<< " " << currentStart << "\n" << " " << currentStart << "\n"
<< "does not contain a CMakeLists.txt file."; << "does not contain a CMakeLists.txt file.";
/* clang-format on */
switch (this->GetPolicyStatus(cmPolicies::CMP0014)) switch (this->GetPolicyStatus(cmPolicies::CMP0014))
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
// Print the warning. // Print the warning.
/* clang-format off */
e << "\n" e << "\n"
<< "CMake does not support this case but it used " << "CMake does not support this case but it used "
<< "to work accidentally and is being allowed for " << "to work accidentally and is being allowed for "
<< "compatibility." << "compatibility."
<< "\n" << "\n"
<< cmPolicies::GetPolicyWarning(cmPolicies::CMP0014); << cmPolicies::GetPolicyWarning(cmPolicies::CMP0014);
/* clang-format on */
this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
case cmPolicies::OLD: case cmPolicies::OLD:
// OLD behavior does not warn. // OLD behavior does not warn.
@ -2249,10 +2255,12 @@ void cmMakefile::ExpandVariablesCMP0019()
this->ExpandVariablesInString(dirs, true, true); this->ExpandVariablesInString(dirs, true, true);
if(pol == cmPolicies::WARN && dirs != includeDirs) if(pol == cmPolicies::WARN && dirs != includeDirs)
{ {
/* clang-format off */
w << "Evaluated directory INCLUDE_DIRECTORIES\n" w << "Evaluated directory INCLUDE_DIRECTORIES\n"
<< " " << includeDirs << "\n" << " " << includeDirs << "\n"
<< "as\n" << "as\n"
<< " " << dirs << "\n"; << " " << dirs << "\n";
/* clang-format on */
} }
this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str()); this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
} }
@ -2274,10 +2282,12 @@ void cmMakefile::ExpandVariablesCMP0019()
this->ExpandVariablesInString(dirs, true, true); this->ExpandVariablesInString(dirs, true, true);
if(pol == cmPolicies::WARN && dirs != includeDirs) if(pol == cmPolicies::WARN && dirs != includeDirs)
{ {
/* clang-format off */
w << "Evaluated target " << t.GetName() << " INCLUDE_DIRECTORIES\n" w << "Evaluated target " << t.GetName() << " INCLUDE_DIRECTORIES\n"
<< " " << includeDirs << "\n" << " " << includeDirs << "\n"
<< "as\n" << "as\n"
<< " " << dirs << "\n"; << " " << dirs << "\n";
/* clang-format on */
} }
t.SetProperty("INCLUDE_DIRECTORIES", dirs.c_str()); t.SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
} }
@ -2292,10 +2302,12 @@ void cmMakefile::ExpandVariablesCMP0019()
this->ExpandVariablesInString(d, true, true); this->ExpandVariablesInString(d, true, true);
if(pol == cmPolicies::WARN && d != orig) if(pol == cmPolicies::WARN && d != orig)
{ {
/* clang-format off */
w << "Evaluated link directories\n" w << "Evaluated link directories\n"
<< " " << orig << "\n" << " " << orig << "\n"
<< "as\n" << "as\n"
<< " " << d << "\n"; << " " << d << "\n";
/* clang-format on */
} }
} }
} }
@ -2309,10 +2321,12 @@ void cmMakefile::ExpandVariablesCMP0019()
this->ExpandVariablesInString(l->first, true, true); this->ExpandVariablesInString(l->first, true, true);
if(pol == cmPolicies::WARN && l->first != orig) if(pol == cmPolicies::WARN && l->first != orig)
{ {
/* clang-format off */
w << "Evaluated link library\n" w << "Evaluated link library\n"
<< " " << orig << "\n" << " " << orig << "\n"
<< "as\n" << "as\n"
<< " " << l->first << "\n"; << " " << l->first << "\n";
/* clang-format on */
} }
} }
} }
@ -2320,10 +2334,12 @@ void cmMakefile::ExpandVariablesCMP0019()
if(!w.str().empty()) if(!w.str().empty())
{ {
std::ostringstream m; std::ostringstream m;
/* clang-format off */
m << cmPolicies::GetPolicyWarning(cmPolicies::CMP0019) m << cmPolicies::GetPolicyWarning(cmPolicies::CMP0019)
<< "\n" << "\n"
<< "The following variable evaluations were encountered:\n" << "The following variable evaluations were encountered:\n"
<< w.str(); << w.str();
/* clang-format on */
this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); this->IssueMessage(cmake::AUTHOR_WARNING, m.str());
} }
} }
@ -3223,9 +3239,11 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError)
// Report the context in which the unclosed block was opened. // Report the context in which the unclosed block was opened.
cmListFileContext const& lfc = fb->GetStartingContext(); cmListFileContext const& lfc = fb->GetStartingContext();
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "A logical block opening on the line\n" e << "A logical block opening on the line\n"
<< " " << lfc << "\n" << " " << lfc << "\n"
<< "is not closed."; << "is not closed.";
/* clang-format on */
this->IssueMessage(cmake::FATAL_ERROR, e.str()); this->IssueMessage(cmake::FATAL_ERROR, e.str());
reportError = false; reportError = false;
} }
@ -3397,11 +3415,13 @@ cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb,
cmListFileContext closingContext = cmListFileContext closingContext =
cmListFileContext::FromCommandContext(lff, lfc.FilePath); cmListFileContext::FromCommandContext(lff, lfc.FilePath);
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "A logical block opening on the line\n" e << "A logical block opening on the line\n"
<< " " << lfc << "\n" << " " << lfc << "\n"
<< "closes on the line\n" << "closes on the line\n"
<< " " << closingContext << "\n" << " " << closingContext << "\n"
<< "with mis-matching arguments."; << "with mis-matching arguments.";
/* clang-format on */
this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
} }
cmFunctionBlocker* b = *pos; cmFunctionBlocker* b = *pos;
@ -3741,11 +3761,13 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "File " << currentFile << " includes " e << "File " << currentFile << " includes "
<< moduleInCMakeModulePath << moduleInCMakeModulePath
<< " (found via CMAKE_MODULE_PATH) which shadows " << " (found via CMAKE_MODULE_PATH) which shadows "
<< moduleInCMakeRoot << ". This may cause errors later on .\n" << moduleInCMakeRoot << ". This may cause errors later on .\n"
<< cmPolicies::GetPolicyWarning(cmPolicies::CMP0017); << cmPolicies::GetPolicyWarning(cmPolicies::CMP0017);
/* clang-format on */
this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
// break; // fall through to OLD behaviour // break; // fall through to OLD behaviour
@ -4288,6 +4310,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
// Print the warning. // Print the warning.
/* clang-format off */
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0013) e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0013)
<< "\n" << "\n"
<< "The binary directory\n" << "The binary directory\n"
@ -4299,6 +4322,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
<< "CMake does not support this use case but it used " << "CMake does not support this use case but it used "
<< "to work accidentally and is being allowed for " << "to work accidentally and is being allowed for "
<< "compatibility."; << "compatibility.";
/* clang-format on */
this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
case cmPolicies::OLD: case cmPolicies::OLD:
// OLD behavior does not warn. // OLD behavior does not warn.
@ -4309,12 +4333,14 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
<< "\n"; << "\n";
case cmPolicies::NEW: case cmPolicies::NEW:
// NEW behavior prints the error. // NEW behavior prints the error.
/* clang-format off */
e << "The binary directory\n" e << "The binary directory\n"
<< " " << binPath << "\n" << " " << binPath << "\n"
<< "is already used to build a source directory. " << "is already used to build a source directory. "
<< "It cannot be used to build source directory\n" << "It cannot be used to build source directory\n"
<< " " << srcPath << "\n" << " " << srcPath << "\n"
<< "Specify a unique binary directory name."; << "Specify a unique binary directory name.";
/* clang-format on */
this->IssueMessage(cmake::FATAL_ERROR, e.str()); this->IssueMessage(cmake::FATAL_ERROR, e.str());
break; break;
} }

View File

@ -1057,10 +1057,12 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// Store multiple output pairs in the depend info file. // Store multiple output pairs in the depend info file.
if(!this->MultipleOutputPairs.empty()) if(!this->MultipleOutputPairs.empty())
{ {
/* clang-format off */
*this->InfoFileStream *this->InfoFileStream
<< "\n" << "\n"
<< "# Pairs of files generated by the same build rule.\n" << "# Pairs of files generated by the same build rule.\n"
<< "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n";
/* clang-format on */
for(MultipleOutputPairsType::const_iterator pi = for(MultipleOutputPairsType::const_iterator pi =
this->MultipleOutputPairs.begin(); this->MultipleOutputPairs.begin();
pi != this->MultipleOutputPairs.end(); ++pi) pi != this->MultipleOutputPairs.end(); ++pi)
@ -1075,10 +1077,12 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// Store list of targets linked directly or transitively. // Store list of targets linked directly or transitively.
{ {
/* clang-format off */
*this->InfoFileStream *this->InfoFileStream
<< "\n" << "\n"
<< "# Targets to which this target links.\n" << "# Targets to which this target links.\n"
<< "set(CMAKE_TARGET_LINKED_INFO_FILES\n"; << "set(CMAKE_TARGET_LINKED_INFO_FILES\n";
/* clang-format on */
std::vector<std::string> dirs = this->GetLinkedTargetDirectories(); std::vector<std::string> dirs = this->GetLinkedTargetDirectories();
for (std::vector<std::string>::iterator i = dirs.begin(); for (std::vector<std::string>::iterator i = dirs.begin();
i != dirs.end(); ++i) i != dirs.end(); ++i)
@ -1089,11 +1093,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< " )\n"; << " )\n";
} }
/* clang-format off */
*this->InfoFileStream *this->InfoFileStream
<< "\n" << "\n"
<< "# Fortran module output directory.\n" << "# Fortran module output directory.\n"
<< "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << "set(CMAKE_Fortran_TARGET_MODULE_DIR \""
<< this->GetFortranModuleDirectory() << "\")\n"; << this->GetFortranModuleDirectory() << "\")\n";
/* clang-format on */
// and now write the rule to use it // and now write the rule to use it
std::vector<std::string> depends; std::vector<std::string> depends;
@ -1308,11 +1314,13 @@ cmMakefileTargetGenerator
variableNameExternal = variableNameExternal =
this->LocalGenerator->CreateMakeVariable(this->GeneratorTarget->GetName(), this->LocalGenerator->CreateMakeVariable(this->GeneratorTarget->GetName(),
"_EXTERNAL_OBJECTS"); "_EXTERNAL_OBJECTS");
/* clang-format off */
*this->BuildFileStream *this->BuildFileStream
<< "\n" << "\n"
<< "# External object files for target " << "# External object files for target "
<< this->GeneratorTarget->GetName() << "\n" << this->GeneratorTarget->GetName() << "\n"
<< variableNameExternal << " ="; << variableNameExternal << " =";
/* clang-format on */
for(std::vector<std::string>::const_iterator i = for(std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin(); this->ExternalObjects.begin();
i != this->ExternalObjects.end(); ++i) i != this->ExternalObjects.end(); ++i)

View File

@ -2618,11 +2618,13 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
if(emsg) if(emsg)
{ {
std::ostringstream e; std::ostringstream e;
/* clang-format off */
e << "The current " << se_name[i] << " is:\n" e << "The current " << se_name[i] << " is:\n"
<< " " << se[i]->Value << "\n" << " " << se[i]->Value << "\n"
<< "which does not contain:\n" << "which does not contain:\n"
<< " " << oldRPath << "\n" << " " << oldRPath << "\n"
<< "as was expected."; << "as was expected.";
/* clang-format on */
*emsg = e.str(); *emsg = e.str();
} }
return false; return false;

View File

@ -335,6 +335,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
{ {
if (firstTryRun) if (firstTryRun)
{ {
/* clang-format off */
file << "# This file was generated by CMake because it detected " file << "# This file was generated by CMake because it detected "
"TRY_RUN() commands\n" "TRY_RUN() commands\n"
"# in crosscompiling mode. It will be overwritten by the next " "# in crosscompiling mode. It will be overwritten by the next "
@ -342,6 +343,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
"# Copy it to a safe location, set the variables to " "# Copy it to a safe location, set the variables to "
"appropriate values\n" "appropriate values\n"
"# and use it then to preset the CMake cache (using -C).\n\n"; "# and use it then to preset the CMake cache (using -C).\n\n";
/* clang-format on */
} }
std::string comment ="\n"; std::string comment ="\n";

View File

@ -3434,6 +3434,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80()
cmGeneratedFileStream fout(manifestFile.c_str()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
/* clang-format off */
fout << fout <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Deployment" "<Deployment"
@ -3469,6 +3470,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80()
"\t\t</ScreenResolutions>\n" "\t\t</ScreenResolutions>\n"
"\t</App>\n" "\t</App>\n"
"</Deployment>\n"; "</Deployment>\n";
/* clang-format on */
std::string sourceFile = this->ConvertPath(manifestFile, false); std::string sourceFile = this->ConvertPath(manifestFile, false);
this->ConvertToWindowsSlash(sourceFile); this->ConvertToWindowsSlash(sourceFile);
@ -3518,6 +3520,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81()
cmGeneratedFileStream fout(manifestFile.c_str()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
/* clang-format off */
fout << fout <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\"" "<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\""
@ -3561,6 +3564,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81()
"\t\t</Application>\n" "\t\t</Application>\n"
"\t</Applications>\n" "\t</Applications>\n"
"</Package>\n"; "</Package>\n";
/* clang-format on */
this->WriteCommonMissingFiles(manifestFile); this->WriteCommonMissingFiles(manifestFile);
} }
@ -3579,6 +3583,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80()
cmGeneratedFileStream fout(manifestFile.c_str()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
/* clang-format off */
fout << fout <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\">\n" "<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\">\n"
@ -3614,6 +3619,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80()
"\t\t</Application>\n" "\t\t</Application>\n"
"\t</Applications>\n" "\t</Applications>\n"
"</Package>\n"; "</Package>\n";
/* clang-format on */
this->WriteCommonMissingFiles(manifestFile); this->WriteCommonMissingFiles(manifestFile);
} }
@ -3632,6 +3638,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81()
cmGeneratedFileStream fout(manifestFile.c_str()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
/* clang-format off */
fout << fout <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\"" "<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\""
@ -3672,6 +3679,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81()
"\t\t</Application>\n" "\t\t</Application>\n"
"\t</Applications>\n" "\t</Applications>\n"
"</Package>\n"; "</Package>\n";
/* clang-format on */
this->WriteCommonMissingFiles(manifestFile); this->WriteCommonMissingFiles(manifestFile);
} }
@ -3690,6 +3698,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0()
cmGeneratedFileStream fout(manifestFile.c_str()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
/* clang-format off */
fout << fout <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Package\n\t" "<Package\n\t"
@ -3731,6 +3740,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0()
"\t\t</Application>\n" "\t\t</Application>\n"
"\t</Applications>\n" "\t</Applications>\n"
"</Package>\n"; "</Package>\n";
/* clang-format on */
this->WriteCommonMissingFiles(manifestFile); this->WriteCommonMissingFiles(manifestFile);
} }

View File

@ -1229,10 +1229,12 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
} }
std::vector<SaveCacheEntry> saved; std::vector<SaveCacheEntry> saved;
std::ostringstream warning; std::ostringstream warning;
/* clang-format off */
warning warning
<< "You have changed variables that require your cache to be deleted.\n" << "You have changed variables that require your cache to be deleted.\n"
<< "Configure will be re-run and you may have to reset some variables.\n" << "Configure will be re-run and you may have to reset some variables.\n"
<< "The following variables have changed:\n"; << "The following variables have changed:\n";
/* clang-format on */
for(std::vector<std::string>::iterator i = argsSplit.begin(); for(std::vector<std::string>::iterator i = argsSplit.begin();
i != argsSplit.end(); ++i) i != argsSplit.end(); ++i)
{ {

View File

@ -257,10 +257,12 @@ int do_cmake(int ac, char const* const* av)
{ {
if(strcmp(av[i], "-i") == 0) if(strcmp(av[i], "-i") == 0)
{ {
/* clang-format off */
std::cerr << std::cerr <<
"The \"cmake -i\" wizard mode is no longer supported.\n" "The \"cmake -i\" wizard mode is no longer supported.\n"
"Use the -D option to set cache values on the command line.\n" "Use the -D option to set cache values on the command line.\n"
"Use cmake-gui or ccmake for an interactive dialog.\n"; "Use cmake-gui or ccmake for an interactive dialog.\n";
/* clang-format on */
return 1; return 1;
} }
else if(strcmp(av[i], "--system-information") == 0) else if(strcmp(av[i], "--system-information") == 0)
@ -453,11 +455,13 @@ static int do_build(int ac, char const* const* av)
} }
if(dir.empty()) if(dir.empty())
{ {
/* clang-format off */
std::cerr << std::cerr <<
"Usage: cmake --build <dir> [options] [-- [native-options]]\n" "Usage: cmake --build <dir> [options] [-- [native-options]]\n"
"Options:\n" "Options:\n"
CMAKE_BUILD_OPTIONS CMAKE_BUILD_OPTIONS
; ;
/* clang-format on */
return 1; return 1;
} }

View File

@ -44,14 +44,19 @@ void CMakeCommandUsage(const char* program)
std::ostringstream errorStream; std::ostringstream errorStream;
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
/* clang-format off */
errorStream errorStream
<< "cmake version " << cmVersion::GetCMakeVersion() << "\n"; << "cmake version " << cmVersion::GetCMakeVersion() << "\n";
/* clang-format on */
#else #else
/* clang-format off */
errorStream errorStream
<< "cmake bootstrap\n"; << "cmake bootstrap\n";
/* clang-format on */
#endif #endif
// If you add new commands, change here, // If you add new commands, change here,
// and in cmakemain.cxx in the options table // and in cmakemain.cxx in the options table
/* clang-format off */
errorStream errorStream
<< "Usage: " << program << " -E <command> [arguments...]\n" << "Usage: " << program << " -E <command> [arguments...]\n"
<< "Available commands: \n" << "Available commands: \n"
@ -95,6 +100,7 @@ void CMakeCommandUsage(const char* program)
<< " create_symlink old new - create a symbolic link new -> old\n" << " create_symlink old new - create a symbolic link new -> old\n"
#endif #endif
; ;
/* clang-format on */
cmSystemTools::Error(errorStream.str().c_str()); cmSystemTools::Error(errorStream.str().c_str());
} }