ENH: protect the export files against inclusion with cmake 2.4

Alex
This commit is contained in:
Alexander Neundorf 2008-04-27 07:30:46 -04:00
parent 05f84cb091
commit 68d6394cef
1 changed files with 6 additions and 0 deletions

View File

@ -79,6 +79,12 @@ bool cmExportFileGenerator::GenerateImportFile()
}
std::ostream& os = *foutPtr;
// Protect that file against use with older CMake versions.
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(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n";
// 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