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