Browse Source

export: Immediately report actual version required

Slightly tweak the logic that tests if a user can consume exported
targets to immediately report the actual version required, rather than
potentially giving the consumer false hope by reporting that 2.8 is
required, only to immediately run another check that requires a more
recent CMake version. (Note that the two-level check is presumably
needed because CMake < 2.8 wouldn't understand VERSION_LESS.)
Matthew Woehlke 1 year ago
parent
commit
0352376e44
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Source/cmExportFileGenerator.cxx

+ 4 - 1
Source/cmExportFileGenerator.cxx

@@ -994,7 +994,10 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
   /* clang-format off */
   /* clang-format off */
   os << "# Generated by CMake\n\n";
   os << "# Generated by CMake\n\n";
   os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.8)\n"
   os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.8)\n"
-     << "   message(FATAL_ERROR \"CMake >= 2.8.0 required\")\n"
+     << "   message(FATAL_ERROR \"CMake >= "
+     << this->RequiredCMakeVersionMajor << '.'
+     << this->RequiredCMakeVersionMinor << '.'
+     << this->RequiredCMakeVersionPatch << " required\")\n"
      << "endif()\n"
      << "endif()\n"
      << "if(CMAKE_VERSION VERSION_LESS \""
      << "if(CMAKE_VERSION VERSION_LESS \""
      << this->RequiredCMakeVersionMajor << '.'
      << this->RequiredCMakeVersionMajor << '.'