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