瀏覽代碼

ENH: expand variables in arguments before the commands get them

Bill Hoffman 24 年之前
父節點
當前提交
4651dbcfc6
共有 37 個文件被更改,包括 44 次插入138 次删除
  1. 1 3
      Source/cmAddCustomCommandCommand.cxx
  2. 3 6
      Source/cmAddCustomTargetCommand.cxx
  3. 1 3
      Source/cmAddDefinitionsCommand.cxx
  4. 1 12
      Source/cmAddDependenciesCommand.cxx
  5. 0 7
      Source/cmAddExecutableCommand.cxx
  6. 1 5
      Source/cmAddLibraryCommand.cxx
  7. 1 3
      Source/cmAddTestCommand.cxx
  8. 0 1
      Source/cmBuildCommand.cxx
  9. 3 10
      Source/cmCableClassSetCommand.cxx
  10. 2 10
      Source/cmCableWrapTclCommand.cxx
  11. 0 2
      Source/cmConfigureFileCommand.cxx
  12. 1 3
      Source/cmElseCommand.cxx
  13. 0 1
      Source/cmEndIfCommand.cxx
  14. 1 4
      Source/cmExecProgramCommand.cxx
  15. 1 4
      Source/cmFindFileCommand.cxx
  16. 0 3
      Source/cmFindLibraryCommand.cxx
  17. 0 1
      Source/cmFindPathCommand.cxx
  18. 0 2
      Source/cmFindProgramCommand.cxx
  19. 0 1
      Source/cmGetFilenameComponentCommand.cxx
  20. 1 4
      Source/cmIfCommand.cxx
  21. 2 4
      Source/cmIncludeCommand.cxx
  22. 0 1
      Source/cmIncludeExternalMSProjectCommand.cxx
  23. 0 2
      Source/cmInstallFilesCommand.cxx
  24. 1 4
      Source/cmInstallProgramsCommand.cxx
  25. 2 6
      Source/cmLoadCacheCommand.cxx
  26. 1 3
      Source/cmMakeDirectoryCommand.cxx
  27. 14 2
      Source/cmMakefile.cxx
  28. 0 1
      Source/cmMessageCommand.cxx
  29. 0 1
      Source/cmOptionCommand.cxx
  30. 0 4
      Source/cmOutputRequiredFilesCommand.cxx
  31. 0 2
      Source/cmSetCommand.cxx
  32. 0 2
      Source/cmSourceFilesCommand.cxx
  33. 1 3
      Source/cmSubdirCommand.cxx
  34. 0 1
      Source/cmSystemTools.cxx
  35. 1 1
      Source/cmUnixMakefileGenerator.cxx
  36. 2 5
      Source/cmUseMangledMesaCommand.cxx
  37. 3 11
      Source/cmVTKMakeInstantiatorCommand.cxx

+ 1 - 3
Source/cmAddCustomCommandCommand.cxx

@@ -48,8 +48,7 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& args
 
 
   for (unsigned int j = 0; j < args.size(); ++j)
   for (unsigned int j = 0; j < args.size(); ++j)
     {
     {
-    std::string copy = args[j];
-    m_Makefile->ExpandVariablesInString(copy);
+    std::string const& copy = args[j];
 
 
     if(copy == "SOURCE")
     if(copy == "SOURCE")
       {
       {
@@ -124,7 +123,6 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& args
     this->SetError("Wrong syntax. Empty TARGET.");
     this->SetError("Wrong syntax. Empty TARGET.");
     return false;
     return false;
     }
     }
-
   m_Makefile->AddCustomCommand(source.c_str(), 
   m_Makefile->AddCustomCommand(source.c_str(), 
                                command.c_str(), 
                                command.c_str(), 
                                command_args, 
                                command_args, 

+ 3 - 6
Source/cmAddCustomTargetCommand.cxx

@@ -17,9 +17,8 @@
 #include "cmAddCustomTargetCommand.h"
 #include "cmAddCustomTargetCommand.h"
 
 
 // cmAddCustomTargetCommand
 // cmAddCustomTargetCommand
-bool cmAddCustomTargetCommand::InitialPass(std::vector<std::string> const& argsIn)
+bool cmAddCustomTargetCommand::InitialPass(std::vector<std::string> const& args)
 {
 {
-  std::vector<std::string> args = argsIn;
   bool all = false;
   bool all = false;
   
   
   if(args.size() < 2 )
   if(args.size() < 2 )
@@ -27,11 +26,10 @@ bool cmAddCustomTargetCommand::InitialPass(std::vector<std::string> const& argsI
     this->SetError("called with incorrect number of arguments");
     this->SetError("called with incorrect number of arguments");
     return false;
     return false;
     }
     }
-  m_Makefile->ExpandVariablesInString(args[0]);
 
 
   // all target option
   // all target option
   std::string arguments;
   std::string arguments;
-  std::vector<std::string>::iterator s = args.begin();
+  std::vector<std::string>::const_iterator s = args.begin();
   ++s; // move past args[0] as it is already to be used
   ++s; // move past args[0] as it is already to be used
   if (args.size() >= 3)
   if (args.size() >= 3)
     {
     {
@@ -44,12 +42,11 @@ bool cmAddCustomTargetCommand::InitialPass(std::vector<std::string> const& argsI
   std::string command;
   std::string command;
   if(s != args.end())
   if(s != args.end())
     {
     {
-    command = m_Makefile->ExpandVariablesInString(*s);
+    command = *s;
     ++s;
     ++s;
     }
     }
   for (;s != args.end(); ++s)
   for (;s != args.end(); ++s)
     {
     {
-    m_Makefile->ExpandVariablesInString(*s);
     arguments += cmSystemTools::EscapeSpaces(s->c_str());
     arguments += cmSystemTools::EscapeSpaces(s->c_str());
     arguments += " ";
     arguments += " ";
     }
     }

+ 1 - 3
Source/cmAddDefinitionsCommand.cxx

@@ -27,9 +27,7 @@ bool cmAddDefinitionsCommand::InitialPass(std::vector<std::string> const& args)
   for(std::vector<std::string>::const_iterator i = args.begin();
   for(std::vector<std::string>::const_iterator i = args.begin();
       i != args.end(); ++i)
       i != args.end(); ++i)
     {
     {
-    std::string str = *i;
-    m_Makefile->ExpandVariablesInString(str);
-    m_Makefile->AddDefineFlag(str.c_str());
+    m_Makefile->AddDefineFlag(i->c_str());
     }
     }
   return true;
   return true;
 }
 }

+ 1 - 12
Source/cmAddDependenciesCommand.cxx

@@ -27,7 +27,6 @@ bool cmAddDependenciesCommand::InitialPass(std::vector<std::string> const& args)
     }
     }
   
   
   std::string target_name = args[0];
   std::string target_name = args[0];
-  m_Makefile->ExpandVariablesInString(target_name);
 
 
   cmTargets &tgts = m_Makefile->GetTargets();
   cmTargets &tgts = m_Makefile->GetTargets();
   if (tgts.find(target_name) != tgts.end())
   if (tgts.find(target_name) != tgts.end())
@@ -37,21 +36,11 @@ bool cmAddDependenciesCommand::InitialPass(std::vector<std::string> const& args)
     std::string depend_target;
     std::string depend_target;
     for (; s != args.end(); ++s)
     for (; s != args.end(); ++s)
       {
       {
-      depend_target = *s;
-      m_Makefile->ExpandVariablesInString(depend_target);
-      tgts[target_name].AddUtility(depend_target.c_str());
+      tgts[target_name].AddUtility(s->c_str());
       }
       }
     }
     }
   else
   else
     {
     {
-    std::cerr << "existing targets are:";
-    
-    for(cmTargets::iterator i = tgts.begin();
-        i != tgts.end(); ++i)
-      {
-      std::cerr << i->first << std::endl;
-      }
-    
     std::string error = "Adding dependency to non-existent target: ";
     std::string error = "Adding dependency to non-existent target: ";
     error += target_name;
     error += target_name;
     this->SetError(error.c_str());
     this->SetError(error.c_str());

+ 0 - 7
Source/cmAddExecutableCommand.cxx

@@ -29,7 +29,6 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args)
   std::vector<std::string>::const_iterator s = args.begin();
   std::vector<std::string>::const_iterator s = args.begin();
 
 
   std::string exename = *s;
   std::string exename = *s;
-  m_Makefile->ExpandVariablesInString(exename);
 
 
   ++s;
   ++s;
   bool use_win32 = false;
   bool use_win32 = false;
@@ -41,12 +40,6 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args)
     }
     }
 
 
   std::vector<std::string> srclists(s, args.end());
   std::vector<std::string> srclists(s, args.end());
-  for(std::vector<std::string>::iterator j = srclists.begin();
-      j != srclists.end(); ++j)
-    {
-    m_Makefile->ExpandVariablesInString(*j);
-    }
-
   m_Makefile->AddExecutable(exename.c_str(), srclists, use_win32); 
   m_Makefile->AddExecutable(exename.c_str(), srclists, use_win32); 
   
   
   return true;
   return true;

+ 1 - 5
Source/cmAddLibraryCommand.cxx

@@ -33,7 +33,6 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args)
   std::vector<std::string>::const_iterator s = args.begin();
   std::vector<std::string>::const_iterator s = args.begin();
 
 
   std::string libname = *s;
   std::string libname = *s;
-  m_Makefile->ExpandVariablesInString(libname);
 
 
   ++s;
   ++s;
   
   
@@ -43,7 +42,6 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args)
   if(s != args.end())
   if(s != args.end())
     {
     {
     std::string libType = *s;
     std::string libType = *s;
-    m_Makefile->ExpandVariablesInString(libType);
     if(libType == "STATIC")
     if(libType == "STATIC")
       {
       {
       ++s;
       ++s;
@@ -64,9 +62,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args)
   std::vector<std::string> srclists;
   std::vector<std::string> srclists;
   while (s != args.end()) 
   while (s != args.end()) 
     {
     {
-    std::string copy = *s;
-    m_Makefile->ExpandVariablesInString(copy);
-    srclists.push_back(copy);  
+    srclists.push_back(*s);  
     ++s;
     ++s;
     }
     }
 
 

+ 1 - 3
Source/cmAddTestCommand.cxx

@@ -38,9 +38,7 @@ bool cmAddTestCommand::InitialPass(std::vector<std::string> const& args)
   for (std::vector<std::string>::const_iterator j = args.begin(); 
   for (std::vector<std::string>::const_iterator j = args.begin(); 
        j != args.end(); ++j)
        j != args.end(); ++j)
     {
     {
-    temp = *j;
-    m_Makefile->ExpandVariablesInString(temp);
-    m_Args.push_back(temp);
+    m_Args.push_back(*j);
     }
     }
   
   
   return true;
   return true;

+ 0 - 1
Source/cmBuildCommand.cxx

@@ -33,7 +33,6 @@ bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
     }
     }
   std::string makecommand;
   std::string makecommand;
   std::string makeprogram = args[1];
   std::string makeprogram = args[1];
-  m_Makefile->ExpandVariablesInString(makeprogram);
   if(makeprogram.find("msdev") != std::string::npos ||
   if(makeprogram.find("msdev") != std::string::npos ||
      makeprogram.find("MSDEV") != std::string::npos )
      makeprogram.find("MSDEV") != std::string::npos )
     {
     {

+ 3 - 10
Source/cmCableClassSetCommand.cxx

@@ -19,21 +19,14 @@
 #include "cmTarget.h"
 #include "cmTarget.h"
 
 
 // cmCableClassSetCommand
 // cmCableClassSetCommand
-bool cmCableClassSetCommand::InitialPass(std::vector<std::string> const& argsIn)
+bool cmCableClassSetCommand::InitialPass(std::vector<std::string> const& args)
 {
 {
-  if(argsIn.size() < 2)
+  if(args.size() < 2)
     {
     {
     this->SetError("called with incorrect number of arguments");
     this->SetError("called with incorrect number of arguments");
     return false;
     return false;
     }
     }
-  std::vector<std::string> args = argsIn;
-  // First, we want to expand all CMAKE variables in all arguments.
-  for(std::vector<std::string>::iterator a = args.begin();
-      a != args.end(); ++a)
-    {
-    m_Makefile->ExpandVariablesInString(*a);
-    }
-  
+
   // The first argument is the name of the set.
   // The first argument is the name of the set.
   std::vector<std::string>::const_iterator arg = args.begin();
   std::vector<std::string>::const_iterator arg = args.begin();
   m_ClassSetName = *arg++;
   m_ClassSetName = *arg++;

+ 2 - 10
Source/cmCableWrapTclCommand.cxx

@@ -122,22 +122,14 @@ cmCableWrapTclCommand::~cmCableWrapTclCommand()
 
 
 
 
 // cmCableWrapTclCommand
 // cmCableWrapTclCommand
-bool cmCableWrapTclCommand::InitialPass(std::vector<std::string> const& argsIn)
+bool cmCableWrapTclCommand::InitialPass(std::vector<std::string> const& args)
 {
 {
-  if(argsIn.size() < 2)
+  if(args.size() < 2)
     {
     {
     this->SetError("called with incorrect number of arguments");
     this->SetError("called with incorrect number of arguments");
     return false;
     return false;
     }
     }
-  std::vector<std::string>  args = argsIn;
 
 
-  // First, we want to expand all CMAKE variables in all arguments.
-  for(std::vector<std::string>::iterator a = args.begin();
-      a != args.end(); ++a)
-    {
-    m_Makefile->ExpandVariablesInString(*a);
-    }
-  
   // Prepare to iterate through the arguments.
   // Prepare to iterate through the arguments.
   std::vector<std::string>::const_iterator arg = args.begin();
   std::vector<std::string>::const_iterator arg = args.begin();
   
   

+ 0 - 2
Source/cmConfigureFileCommand.cxx

@@ -70,9 +70,7 @@ void cmConfigureFileCommand::FinalPass()
 
 
 void cmConfigureFileCommand::ConfigureFile()
 void cmConfigureFileCommand::ConfigureFile()
 {
 {
-  m_Makefile->ExpandVariablesInString(m_InputFile);
   m_Makefile->AddCMakeDependFile(m_InputFile.c_str());
   m_Makefile->AddCMakeDependFile(m_InputFile.c_str());
-  m_Makefile->ExpandVariablesInString(m_OuputFile);
   cmSystemTools::ConvertToUnixSlashes(m_OuputFile);
   cmSystemTools::ConvertToUnixSlashes(m_OuputFile);
   std::string::size_type pos = m_OuputFile.rfind('/');
   std::string::size_type pos = m_OuputFile.rfind('/');
   if(pos != std::string::npos)
   if(pos != std::string::npos)

+ 1 - 3
Source/cmElseCommand.cxx

@@ -51,9 +51,7 @@ bool cmElseCommand::InitialPass(std::vector<std::string> const& args)
 
 
   if (args.size() == 2 && (args[0] == "EXISTS"))
   if (args.size() == 2 && (args[0] == "EXISTS"))
     {
     {
-    std::string tmp = args[1];
-    m_Makefile->ExpandVariablesInString(tmp);
-    if(cmSystemTools::FileExists(tmp.c_str()))
+    if(cmSystemTools::FileExists(args[1].c_str()))
       {
       {
       f = new cmIfFunctionBlocker();
       f = new cmIfFunctionBlocker();
       }
       }

+ 0 - 1
Source/cmEndIfCommand.cxx

@@ -24,7 +24,6 @@ bool cmEndIfCommand::InitialPass(std::vector<std::string> const& args)
     this->SetError("called with incorrect number of arguments");
     this->SetError("called with incorrect number of arguments");
     return false;
     return false;
     }
     }
-
   // remove any function blockers for this define
   // remove any function blockers for this define
   m_Makefile->RemoveFunctionBlocker("ENDIF",args);
   m_Makefile->RemoveFunctionBlocker("ENDIF",args);
   
   

+ 1 - 4
Source/cmExecProgramCommand.cxx

@@ -18,19 +18,16 @@
 #include "cmSystemTools.h"
 #include "cmSystemTools.h"
 
 
 // cmExecProgramCommand
 // cmExecProgramCommand
-bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
+bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args)
 {
 {
-  std::vector<std::string>  args = argsIn;
   if(args.size() < 1 )
   if(args.size() < 1 )
     {
     {
     this->SetError("called with incorrect number of arguments");
     this->SetError("called with incorrect number of arguments");
     return false;
     return false;
     }
     }
   std::string output;
   std::string output;
-  m_Makefile->ExpandVariablesInString(args[0]);
   if(args.size() == 2)
   if(args.size() == 2)
     {
     {
-    m_Makefile->ExpandVariablesInString(args[1]);
     cmSystemTools::MakeDirectory(args[1].c_str());
     cmSystemTools::MakeDirectory(args[1].c_str());
     std::string command;
     std::string command;
     command = "cd ";
     command = "cd ";

+ 1 - 4
Source/cmFindFileCommand.cxx

@@ -65,11 +65,8 @@ bool cmFindFileCommand::InitialPass(std::vector<std::string> const& argsIn)
   // add any user specified paths
   // add any user specified paths
   for (unsigned int j = 2; j < args.size(); j++)
   for (unsigned int j = 2; j < args.size(); j++)
     {
     {
-    // expand variables
-    std::string exp = args[j];
-    m_Makefile->ExpandVariablesInString(exp);
     // Glob the entry in case of wildcards.
     // Glob the entry in case of wildcards.
-    cmSystemTools::GlobDirs(exp.c_str(), path);
+    cmSystemTools::GlobDirs(args[j].c_str(), path);
     }
     }
 
 
   // add the standard path
   // add the standard path

+ 0 - 3
Source/cmFindLibraryCommand.cxx

@@ -63,14 +63,12 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
       }
       }
     else
     else
       { 
       { 
-      m_Makefile->ExpandVariablesInString(args[j]);
       if(doingNames)
       if(doingNames)
         {
         {
         names.push_back(args[j]);
         names.push_back(args[j]);
         }
         }
       else
       else
         {
         {
-        cmSystemTools::ExpandRegistryValues(args[j]);
         // Glob the entry in case of wildcards.
         // Glob the entry in case of wildcards.
         cmSystemTools::GlobDirs(args[j].c_str(), path);
         cmSystemTools::GlobDirs(args[j].c_str(), path);
         }
         }
@@ -87,7 +85,6 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
       {
       {
       // expand variables
       // expand variables
       std::string exp = args[j];
       std::string exp = args[j];
-      m_Makefile->ExpandVariablesInString(exp);
       cmSystemTools::ExpandRegistryValues(exp);
       cmSystemTools::ExpandRegistryValues(exp);
       
       
       // Glob the entry in case of wildcards.
       // Glob the entry in case of wildcards.

+ 0 - 1
Source/cmFindPathCommand.cxx

@@ -68,7 +68,6 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
     {
     {
     // expand variables
     // expand variables
     std::string exp = args[j];
     std::string exp = args[j];
-    m_Makefile->ExpandVariablesInString(exp);
     cmSystemTools::ExpandRegistryValues(exp);      
     cmSystemTools::ExpandRegistryValues(exp);      
 
 
     // Glob the entry in case of wildcards.
     // Glob the entry in case of wildcards.

+ 0 - 2
Source/cmFindProgramCommand.cxx

@@ -86,7 +86,6 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
       }
       }
     else
     else
       { 
       { 
-      m_Makefile->ExpandVariablesInString(args[j]);
       if(doingNames)
       if(doingNames)
         {
         {
         names.push_back(args[j]);
         names.push_back(args[j]);
@@ -110,7 +109,6 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
       {
       {
       // expand variables
       // expand variables
       std::string exp = args[j];
       std::string exp = args[j];
-      m_Makefile->ExpandVariablesInString(exp);
       cmSystemTools::ExpandRegistryValues(exp);
       cmSystemTools::ExpandRegistryValues(exp);
       
       
       // Glob the entry in case of wildcards.
       // Glob the entry in case of wildcards.

+ 0 - 1
Source/cmGetFilenameComponentCommand.cxx

@@ -39,7 +39,6 @@ bool cmGetFilenameComponentCommand::InitialPass(std::vector<std::string> const&
   
   
   std::string result;
   std::string result;
   std::string filename = args[1];
   std::string filename = args[1];
-  m_Makefile->ExpandVariablesInString(filename);
 
 
   if (args[2] == "PATH")
   if (args[2] == "PATH")
     {
     {

+ 1 - 4
Source/cmIfCommand.cxx

@@ -76,7 +76,6 @@ bool cmIfCommand::InitialPass(std::vector<std::string> const& args)
     this->SetError("called with incorrect number of arguments");
     this->SetError("called with incorrect number of arguments");
     return false;
     return false;
     }
     }
-
   // create a function blocker
   // create a function blocker
   cmIfFunctionBlocker *f = NULL;
   cmIfFunctionBlocker *f = NULL;
 
 
@@ -112,9 +111,7 @@ bool cmIfCommand::InitialPass(std::vector<std::string> const& args)
 
 
   if (args.size() == 2 && (args[0] == "EXISTS"))
   if (args.size() == 2 && (args[0] == "EXISTS"))
     {
     {
-    std::string tmp = args[1];
-    m_Makefile->ExpandVariablesInString(tmp);
-    if(!cmSystemTools::FileExists(tmp.c_str()))
+    if(!cmSystemTools::FileExists(args[1].c_str()))
       {
       {
       f = new cmIfFunctionBlocker();
       f = new cmIfFunctionBlocker();
       }
       }

+ 2 - 4
Source/cmIncludeCommand.cxx

@@ -18,15 +18,13 @@
 
 
 
 
 // cmIncludeCommand
 // cmIncludeCommand
-bool cmIncludeCommand::InitialPass(std::vector<std::string> const& argsIn)
+bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args)
 {
 {
-  if (argsIn.size()< 1 || argsIn.size() > 2)
+  if (args.size()< 1 || args.size() > 2)
     {
     {
       this->SetError("called with wrong number of arguments.  "
       this->SetError("called with wrong number of arguments.  "
                      "Include only takes one file.");
                      "Include only takes one file.");
     }
     }
-  std::vector<std::string> args = argsIn;
-  m_Makefile->ExpandVariablesInString( args[0]);
   bool exists = cmSystemTools::FileExists(args[0].c_str());
   bool exists = cmSystemTools::FileExists(args[0].c_str());
   if(args.size() == 2 && args[1] == "OPTIONAL" && !exists)
   if(args.size() == 2 && args[1] == "OPTIONAL" && !exists)
     {
     {

+ 0 - 1
Source/cmIncludeExternalMSProjectCommand.cxx

@@ -29,7 +29,6 @@ bool cmIncludeExternalMSProjectCommand::InitialPass(std::vector<std::string> con
   if(m_Makefile->GetDefinition("WIN32")) {
   if(m_Makefile->GetDefinition("WIN32")) {
     
     
     std::string location = args[1];
     std::string location = args[1];
-    m_Makefile->ExpandVariablesInString(location);
 
 
     std::vector<std::string> name_and_location;
     std::vector<std::string> name_and_location;
     name_and_location.push_back(args[0]);
     name_and_location.push_back(args[0]);

+ 0 - 2
Source/cmInstallFilesCommand.cxx

@@ -61,7 +61,6 @@ void cmInstallFilesCommand::FinalPass()
       {
       {
       // replace any variables
       // replace any variables
       std::string temps = *s;
       std::string temps = *s;
-      m_Makefile->ExpandVariablesInString(temps);
       // look for a srclist
       // look for a srclist
       if (m_Makefile->GetSources().find(temps) != m_Makefile->GetSources().end())
       if (m_Makefile->GetSources().find(temps) != m_Makefile->GetSources().end())
         {
         {
@@ -88,7 +87,6 @@ void cmInstallFilesCommand::FinalPass()
     {
     {
     std::vector<std::string> files;
     std::vector<std::string> files;
     std::string regex = m_FinalArgs[0].c_str();
     std::string regex = m_FinalArgs[0].c_str();
-    m_Makefile->ExpandVariablesInString(regex);
     cmSystemTools::Glob(m_Makefile->GetCurrentDirectory(),
     cmSystemTools::Glob(m_Makefile->GetCurrentDirectory(),
                         regex.c_str(), files);
                         regex.c_str(), files);
     
     

+ 1 - 4
Source/cmInstallProgramsCommand.cxx

@@ -55,11 +55,8 @@ void cmInstallProgramsCommand::FinalPass()
     for (std::vector<std::string>::iterator s = m_FinalArgs.begin();
     for (std::vector<std::string>::iterator s = m_FinalArgs.begin();
          s != m_FinalArgs.end(); ++s)
          s != m_FinalArgs.end(); ++s)
       {
       {
-      // replace any variables
-      std::string temps = *s;
-      m_Makefile->ExpandVariablesInString(temps);
       // add to the result
       // add to the result
-      targetSourceLists.push_back(temps);
+      targetSourceLists.push_back(*s);
       }
       }
     }
     }
   else     // reg exp list
   else     // reg exp list

+ 2 - 6
Source/cmLoadCacheCommand.cxx

@@ -18,13 +18,12 @@
 
 
 
 
 // cmLoadcacheCommand
 // cmLoadcacheCommand
-bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& argsIn)
+bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& args)
 {
 {
-  if (argsIn.size()< 1)
+  if (args.size()< 1)
     {
     {
     this->SetError("called with wrong number of arguments.");
     this->SetError("called with wrong number of arguments.");
     }
     }
-  std::vector<std::string> args = argsIn;
   
   
   // Cache entries to be excluded from the import list.
   // Cache entries to be excluded from the import list.
   // If this set is empty, all cache entries are brought in
   // If this set is empty, all cache entries are brought in
@@ -37,7 +36,6 @@ bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& argsIn)
     {
     {
     if (excludeFiles)
     if (excludeFiles)
       {
       {
-      m_Makefile->ExpandVariablesInString(args[i]);
       excludes.insert(args[i]);
       excludes.insert(args[i]);
       }
       }
     if (args[i] == "EXCLUDE")
     if (args[i] == "EXCLUDE")
@@ -60,7 +58,6 @@ bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& argsIn)
     {
     {
     if (includeFiles)
     if (includeFiles)
       {
       {
-      m_Makefile->ExpandVariablesInString(args[i]);
       includes.insert(args[i]);
       includes.insert(args[i]);
       }
       }
     if (args[i] == "INCLUDE_INTERNALS")
     if (args[i] == "INCLUDE_INTERNALS")
@@ -81,7 +78,6 @@ bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& argsIn)
       {
       {
       break;
       break;
       }
       }
-    m_Makefile->ExpandVariablesInString(args[i]);
     cmCacheManager::GetInstance()->LoadCache(args[i].c_str(), false,
     cmCacheManager::GetInstance()->LoadCache(args[i].c_str(), false,
 					     excludes, includes);
 					     excludes, includes);
     }
     }

+ 1 - 3
Source/cmMakeDirectoryCommand.cxx

@@ -25,9 +25,7 @@ bool cmMakeDirectoryCommand::InitialPass(std::vector<std::string> const& args)
     this->SetError("called with incorrect number of arguments");
     this->SetError("called with incorrect number of arguments");
     return false;
     return false;
     }
     }
-  std::string arg = args[0];
-  m_Makefile->ExpandVariablesInString(arg);
-  cmSystemTools::MakeDirectory(arg.c_str());
+  cmSystemTools::MakeDirectory(args[0].c_str());
   return true;
   return true;
 }
 }
 
 

+ 14 - 2
Source/cmMakefile.cxx

@@ -210,7 +210,13 @@ void cmMakefile::ExecuteCommand(std::string &name,
       // if the command is inherited then InitialPass it.
       // if the command is inherited then InitialPass it.
       if(!m_Inheriting || usedCommand->IsInherited())
       if(!m_Inheriting || usedCommand->IsInherited())
         {
         {
-        if(!usedCommand->InitialPass(arguments))
+        std::vector<std::string> expandedArguments = arguments;
+        for(std::vector<std::string>::iterator i = expandedArguments.begin();
+            i != expandedArguments.end(); ++i)
+          {
+          this->ExpandVariablesInString(*i);
+          }
+        if(!usedCommand->InitialPass(expandedArguments))
           {
           {
           cmSystemTools::Error(usedCommand->GetName(),
           cmSystemTools::Error(usedCommand->GetName(),
                                ": Error : \n",
                                ": Error : \n",
@@ -1171,10 +1177,16 @@ bool cmMakefile::IsFunctionBlocked(const char *name,
 {
 {
   // loop over all function blockers to see if any block this command
   // loop over all function blockers to see if any block this command
   std::set<cmFunctionBlocker *>::const_iterator pos;
   std::set<cmFunctionBlocker *>::const_iterator pos;
+  std::vector<std::string> expandedArguments = args;
+  for(std::vector<std::string>::iterator i = expandedArguments.begin();
+      i != expandedArguments.end(); ++i)
+    {
+    this->ExpandVariablesInString(*i);
+    }
   for (pos = m_FunctionBlockers.begin(); 
   for (pos = m_FunctionBlockers.begin(); 
        pos != m_FunctionBlockers.end(); ++pos)
        pos != m_FunctionBlockers.end(); ++pos)
     {
     {
-    if ((*pos)->IsFunctionBlocked(name, args, *this))
+    if ((*pos)->IsFunctionBlocked(name, expandedArguments, *this))
       {
       {
       return true;
       return true;
       }
       }

+ 0 - 1
Source/cmMessageCommand.cxx

@@ -31,7 +31,6 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args)
     {
     {
     message += *i;
     message += *i;
     }
     }
-  m_Makefile->ExpandVariablesInString(message);
   cmSystemTools::Message(message.c_str());
   cmSystemTools::Message(message.c_str());
   return true;
   return true;
 }
 }

+ 0 - 1
Source/cmOptionCommand.cxx

@@ -35,7 +35,6 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args)
     if(args.size() == 3)
     if(args.size() == 3)
       {
       {
       initialValue = args[2];
       initialValue = args[2];
-      m_Makefile->ExpandVariablesInString(initialValue);
       }
       }
     m_Makefile->AddCacheDefinition(args[0].c_str(),
     m_Makefile->AddCacheDefinition(args[0].c_str(),
                                    cmSystemTools::IsOn(initialValue.c_str()),
                                    cmSystemTools::IsOn(initialValue.c_str()),

+ 0 - 4
Source/cmOutputRequiredFilesCommand.cxx

@@ -185,10 +185,6 @@ void cmOutputRequiredFilesCommand::FinalPass()
   cmLBDepend md;
   cmLBDepend md;
   md.SetMakefile(m_Makefile);
   md.SetMakefile(m_Makefile);
 
 
-  // always expand the first argument
-  m_Makefile->ExpandVariablesInString(m_File);
-  m_Makefile->ExpandVariablesInString(m_OutputFile);
-
   // find the depends for a file
   // find the depends for a file
   const cmDependInformation *info = md.FindDependencies(m_File.c_str());
   const cmDependInformation *info = md.FindDependencies(m_File.c_str());
   if (info)
   if (info)

+ 0 - 2
Source/cmSetCommand.cxx

@@ -88,8 +88,6 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args)
     type = cmCacheManager::StringToType(args[cacheStart+1].c_str());
     type = cmCacheManager::StringToType(args[cacheStart+1].c_str());
     docstring = args[cacheStart+2].c_str();
     docstring = args[cacheStart+2].c_str();
     }
     }
-  // always expand the first argument
-  m_Makefile->ExpandVariablesInString(value);
   // get the current cache value for the variable
   // get the current cache value for the variable
   const char* cacheValue = 
   const char* cacheValue = 
     m_Makefile->GetDefinition(variable);
     m_Makefile->GetDefinition(variable);

+ 0 - 2
Source/cmSourceFilesCommand.cxx

@@ -26,7 +26,6 @@ bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& args)
     }
     }
   
   
   std::string name = args[0];
   std::string name = args[0];
-  m_Makefile->ExpandVariablesInString(name);
   
   
   int generated = 0;
   int generated = 0;
 
 
@@ -42,7 +41,6 @@ bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& args)
       continue;
       continue;
       }
       }
     cmSourceFile file;
     cmSourceFile file;
-    m_Makefile->ExpandVariablesInString(copy);
     file.SetIsAnAbstractClass(false);
     file.SetIsAnAbstractClass(false);
     std::string path = cmSystemTools::GetFilenamePath(copy);
     std::string path = cmSystemTools::GetFilenamePath(copy);
     if ( generated )
     if ( generated )

+ 1 - 3
Source/cmSubdirCommand.cxx

@@ -24,12 +24,10 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args)
     this->SetError("called with incorrect number of arguments");
     this->SetError("called with incorrect number of arguments");
     return false;
     return false;
     }
     }
-  std::string temp;
   for(std::vector<std::string>::const_iterator i = args.begin();
   for(std::vector<std::string>::const_iterator i = args.begin();
       i != args.end(); ++i)
       i != args.end(); ++i)
     {
     {
-    temp = *i;
-    m_Makefile->AddSubDirectory(m_Makefile->ExpandVariablesInString(temp));
+    m_Makefile->AddSubDirectory(i->c_str());
     }
     }
   return true;
   return true;
 }
 }

+ 0 - 1
Source/cmSystemTools.cxx

@@ -1040,7 +1040,6 @@ bool cmSystemTools::RunCommand(const char* command,
 
 
   retVal = pclose(cpipe);
   retVal = pclose(cpipe);
   retVal = WEXITSTATUS(retVal);
   retVal = WEXITSTATUS(retVal);
-  std::cout << "*** cmSystemTools: return value from " << command << " is "<< retVal << "\n";
   return true;
   return true;
 #endif
 #endif
 }
 }

+ 1 - 1
Source/cmUnixMakefileGenerator.cxx

@@ -1796,7 +1796,7 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
                          "run any tests",
                          "run any tests",
                          "test",
                          "test",
                          "",
                          "",
-                         ctest.c_str());
+                         this->ConvertToOutputPath(ctest.c_str()).c_str());
     }
     }
 }
 }
 
 

+ 2 - 5
Source/cmUseMangledMesaCommand.cxx

@@ -18,19 +18,16 @@
 #include "cmSystemTools.h"
 #include "cmSystemTools.h"
 
 
 // cmUseMangledMesaCommand
 // cmUseMangledMesaCommand
-bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& argsIn)
+bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args)
 { 
 { 
   // expected two arguments:
   // expected two arguments:
   // arguement one: the full path to gl_mangle.h
   // arguement one: the full path to gl_mangle.h
   // arguement two : directory for output of edited headers
   // arguement two : directory for output of edited headers
-  if(argsIn.size() < 2)
+  if(args.size() < 2)
     {
     {
     this->SetError("called with incorrect number of arguments");
     this->SetError("called with incorrect number of arguments");
     return false;
     return false;
     }
     }
-  std::vector<std::string>  args = argsIn;
-  m_Makefile->ExpandVariablesInString(args[0]);
-  m_Makefile->ExpandVariablesInString(args[1]);
   const char* inputDir = args[0].c_str();
   const char* inputDir = args[0].c_str();
   const char* destDir = args[1].c_str();
   const char* destDir = args[1].c_str();
   std::vector<std::string> files;
   std::vector<std::string> files;

+ 3 - 11
Source/cmVTKMakeInstantiatorCommand.cxx

@@ -29,10 +29,8 @@ cmVTKMakeInstantiatorCommand
     }
     }
   
   
   m_ClassName = args[0];
   m_ClassName = args[0];
-  m_Makefile->ExpandVariablesInString(m_ClassName);
   
   
   std::string outSourceList = args[1];
   std::string outSourceList = args[1];
-  m_Makefile->ExpandVariablesInString(outSourceList);
   
   
   std::vector<cmStdString> inSourceLists;
   std::vector<cmStdString> inSourceLists;
   m_ExportMacro = "-";
   m_ExportMacro = "-";
@@ -50,9 +48,7 @@ cmVTKMakeInstantiatorCommand
       includesMode = false;
       includesMode = false;
       if(++i < args.size())
       if(++i < args.size())
         {
         {
-        std::string gSize = args[i].c_str();
-        m_Makefile->ExpandVariablesInString(gSize);
-        groupSize = atoi(gSize.c_str());
+        groupSize = atoi(args[i].c_str());
         }
         }
       else
       else
         {
         {
@@ -66,7 +62,6 @@ cmVTKMakeInstantiatorCommand
       if(++i < args.size())
       if(++i < args.size())
         {
         {
         headerPath = args[i];
         headerPath = args[i];
-        m_Makefile->ExpandVariablesInString(headerPath);
         }
         }
       else
       else
         {
         {
@@ -80,7 +75,6 @@ cmVTKMakeInstantiatorCommand
       if(++i < args.size())
       if(++i < args.size())
         {
         {
         m_ExportMacro = args[i];
         m_ExportMacro = args[i];
-        m_Makefile->ExpandVariablesInString(m_ExportMacro);
         }
         }
       else
       else
         {
         {
@@ -96,15 +90,13 @@ cmVTKMakeInstantiatorCommand
     // an include file.
     // an include file.
     else
     else
       {
       {
-      std::string s = args[i];
-      m_Makefile->ExpandVariablesInString(s);
       if(!includesMode)
       if(!includesMode)
         {
         {
-        inSourceLists.push_back(s);
+        inSourceLists.push_back(args[i]);
         }
         }
       else
       else
         {
         {
-        m_Includes.push_back(s);
+        m_Includes.push_back(args[i]);
         }
         }
       }
       }
     }
     }