From 79756b0e676c9e5e02ad13039ad092b78f64f63d Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Thu, 24 May 2007 08:43:31 -0400 Subject: [PATCH] BUG: don't use non-imported target when cross compiling as commands in custom commands STYLE: remove now invalid comments, use this-> Alex --- Source/cmLocalGenerator.cxx | 8 ++++++-- Source/cmLocalVisualStudio6Generator.cxx | 1 - Source/cmLocalVisualStudio7Generator.cxx | 1 - Source/cmTarget.cxx | 6 +++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 8d2934416..bc0aca44f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/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 ); } diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 41f00a69a..25e32530a 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/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++) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index f3b594db4..54866e563 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/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++) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6d9b419a5..ac8d34bfd 100644 --- a/Source/cmTarget.cxx +++ b/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()) {