Răsfoiți Sursa

ENH: Use new deprecation mechanism

Andy Cedilnik 22 ani în urmă
părinte
comite
0152cc3a35
2 a modificat fișierele cu 16 adăugiri și 6 ștergeri
  1. 10 5
      Source/cmSourceFilesCommand.cxx
  2. 6 1
      Source/cmSourceFilesCommand.h

+ 10 - 5
Source/cmSourceFilesCommand.cxx

@@ -17,16 +17,21 @@
 #include "cmSourceFilesCommand.h"
 #include "cmSourceFilesCommand.h"
 #include <stdlib.h> // required for atof
 #include <stdlib.h> // required for atof
 
 
+bool cmSourceFilesCommand::IsDeprecated(int major, int minor)
+{
+  if ( major >= 1 && minor >= 4 )
+    {
+    this->SetError("The SOURCE_FILES command was deprecated in CMake version 1.4 and will be removed in later versions of CMake. You should modify your CMakeLists.txt files to use the SET command instead, or set the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.2 or less.\n");
+    return true;
+    }
+  return false;
+}
+
 // cmSourceFilesCommand
 // cmSourceFilesCommand
 bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& args)
 bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& args)
 {
 {
   const char* versionValue
   const char* versionValue
     = m_Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
     = m_Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
-  if (atof(versionValue) > 1.4)
-    {
-    this->SetError("The SOURCE_FILES command was deprecated in CMake version 1.4 and will be removed in later versions of CMake. You should modify your CMakeLists.txt files to use the SET command instead, or set the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.2 or less.\n");
-    return false;
-    }
   if (atof(versionValue) > 1.2)
   if (atof(versionValue) > 1.2)
     {
     {
     cmSystemTools::Message("The SOURCE_FILES command was deprecated in CMake version 1.4 and will be removed in later versions. You should modify your CMakeLists.txt files to use the SET command instead, or set the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.2 or less.\n","Warning");
     cmSystemTools::Message("The SOURCE_FILES command was deprecated in CMake version 1.4 and will be removed in later versions. You should modify your CMakeLists.txt files to use the SET command instead, or set the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.2 or less.\n","Warning");

+ 6 - 1
Source/cmSourceFilesCommand.h

@@ -69,7 +69,12 @@ public:
     {
     {
     return "Deprecated.  Use SET to list sources in a variable.";
     return "Deprecated.  Use SET to list sources in a variable.";
     }
     }
-  
+
+  /**
+   * This determines if the method is deprecated or not
+   */
+  virtual bool IsDeprecated(int major, int minor);
+
   /**
   /**
    * More documentation.
    * More documentation.
    */
    */