Do not place CMake version in export files

Files generated by `install(EXPORT)` and `export_library_dependencies()`
may be installed with packages and consumed by dependents.  In order to
avoid re-building dependents only because the version of CMake changed,
drop the CMake version from the export file content.
This commit is contained in:
Christoph Grüninger 2016-07-10 15:35:24 +02:00 committed by Brad King
parent 507aa256e5
commit c376c5bca2
2 changed files with 2 additions and 2 deletions

View File

@ -93,7 +93,7 @@ bool cmExportFileGenerator::GenerateImportFile()
// Protect that file against use with older CMake versions. // Protect that file against use with older CMake versions.
/* clang-format off */ /* clang-format off */
os << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; os << "# Generated by CMake\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";

View File

@ -152,7 +152,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
// versions. // versions.
const char* vertest = const char* vertest =
"\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4"; "\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4";
fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; fout << "# Generated by CMake\n\n";
fout << "if(" << vertest << ")\n"; fout << "if(" << vertest << ")\n";
fout << " # Information for CMake 2.6 and above.\n"; fout << " # Information for CMake 2.6 and above.\n";
for (std::map<std::string, std::string>::const_iterator i = for (std::map<std::string, std::string>::const_iterator i =