Remove cmLocalGenerator::GetRealLocation

The cmCustomCommandGenerator::GetCommand method completely replaces the
purpose of this method.  Re-implement GetRealLocation inline at the only
remaining call site and remove it.
This commit is contained in:
Brad King 2010-12-07 16:28:56 -05:00
parent 542b517449
commit 1a29ccaf9a
3 changed files with 7 additions and 24 deletions

View File

@ -33,7 +33,13 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const
std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
{
std::string const& argv0 = this->CC.GetCommandLines()[c][0];
return this->LG->GetRealLocation(argv0.c_str(), this->Config);
cmTarget* target = this->Makefile->FindTargetToUse(argv0.c_str());
if(target && target->GetType() == cmTarget::EXECUTABLE &&
(target->IsImported() || !this->Makefile->IsOn("CMAKE_CROSSCOMPILING")))
{
return target->GetLocation(this->Config);
}
return argv0;
}
//----------------------------------------------------------------------------

View File

@ -1912,24 +1912,6 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
return true;
}
//----------------------------------------------------------------------------
std::string cmLocalGenerator::GetRealLocation(const char* inName,
const char* config)
{
std::string outName=inName;
// Look for a CMake target with the given name, which is an executable
// and which can be run
cmTarget* target = this->Makefile->FindTargetToUse(inName);
if ((target != 0)
&& (target->GetType() == cmTarget::EXECUTABLE)
&& ((this->Makefile->IsOn("CMAKE_CROSSCOMPILING") == false)
|| (target->IsImported() == true)))
{
outName = target->GetLocation( config );
}
return outName;
}
//----------------------------------------------------------------------------
void cmLocalGenerator::AddSharedFlags(std::string& flags,
const char* lang,

View File

@ -168,11 +168,6 @@ public:
bool GetRealDependency(const char* name, const char* config,
std::string& dep);
/** Translate a command as given in CMake code to the location of the
executable if the command is the name of a CMake executable target.
If that's not the case, just return the original name. */
std::string GetRealLocation(const char* inName, const char* config);
///! for existing files convert to output path and short path if spaces
std::string ConvertToOutputForExisting(const char* remote,
RelativeRoot local = START_OUTPUT);