Browse Source

BUG: don't use non-imported target when cross compiling as commands in custom commands
STYLE: remove now invalid comments, use this->

Alex

Alexander Neundorf 18 năm trước cách đây
mục cha
commit
79756b0e67

+ 6 - 2
Source/cmLocalGenerator.cxx

@@ -2024,9 +2024,13 @@ std::string cmLocalGenerator::GetRealLocation(const char* inName,
                                               const char* config)
 {
   std::string outName=inName;
-  // Look for a CMake target with the given name.
+  // Look for a CMake target with the given name, which is an executable 
+  // and which can be run
   cmTarget* target = this->GlobalGenerator->FindTarget(0, inName, true);
-  if ((target != 0) && (target->GetType() == cmTarget::EXECUTABLE))
+  if ((target != 0)
+       && (target->GetType() == cmTarget::EXECUTABLE)
+       && ((this->Makefile->IsOn("CMAKE_CROSSCOMPILING") == false) 
+            || (target->IsImported() == true)))
     {
     outName = target->GetLocation( config );
     }

+ 0 - 1
Source/cmLocalVisualStudio6Generator.cxx

@@ -106,7 +106,6 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
 
   // clear project names
   this->CreatedProjectNames.clear();
-  // Call TraceVSDependencies on all targets
   cmTargets &tgts = this->Makefile->GetTargets(); 
   for(cmTargets::iterator l = tgts.begin(); 
       l != tgts.end(); l++)

+ 0 - 1
Source/cmLocalVisualStudio7Generator.cxx

@@ -113,7 +113,6 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile()
 
   // Create the VCProj or set of VCProj's for libraries and executables
 
-  // Call TraceVSDependencies on all targets
   cmTargets &tgts = this->Makefile->GetTargets();
   for(cmTargets::iterator l = tgts.begin();
       l != tgts.end(); l++)

+ 3 - 3
Source/cmTarget.cxx

@@ -547,9 +547,9 @@ void cmTarget::TraceVSDependencies(std::string projFile,
       }
     }
 
-  CheckForTargetsAsCommand(this->GetPreBuildCommands());
-  CheckForTargetsAsCommand(this->GetPreLinkCommands());
-  CheckForTargetsAsCommand(this->GetPostBuildCommands());
+  this->CheckForTargetsAsCommand(this->GetPreBuildCommands());
+  this->CheckForTargetsAsCommand(this->GetPreLinkCommands());
+  this->CheckForTargetsAsCommand(this->GetPostBuildCommands());
 
   while (!srcFilesToProcess.empty())
     {