cmTarget: Restore the ImportedGetLocation method.

It was removed in commit f154475b (cmTarget: Refactor GetLocation
API, 2014-03-08), but it is more readable for targets we know are
imported.
This commit is contained in:
Stephen Kelly 2014-03-10 14:42:27 +01:00
parent 50b17a6112
commit 5b60eaf619
3 changed files with 20 additions and 6 deletions

View File

@ -809,7 +809,8 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
autogenTargetName.c_str()); autogenTargetName.c_str());
return; return;
} }
makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation("")); makefile->AddDefinition("_qt_moc_executable",
qt5Moc->ImportedGetLocation(""));
} }
else if (strcmp(qtVersion, "4") == 0) else if (strcmp(qtVersion, "4") == 0)
{ {
@ -820,7 +821,8 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
autogenTargetName.c_str()); autogenTargetName.c_str());
return; return;
} }
makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation("")); makefile->AddDefinition("_qt_moc_executable",
qt4Moc->ImportedGetLocation(""));
} }
else else
{ {
@ -967,7 +969,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
} }
else else
{ {
makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation("")); makefile->AddDefinition("_qt_uic_executable",
qt5Uic->ImportedGetLocation(""));
} }
} }
else if (strcmp(qtVersion, "4") == 0) else if (strcmp(qtVersion, "4") == 0)
@ -979,7 +982,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
targetName.c_str()); targetName.c_str());
return; return;
} }
makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation("")); makefile->AddDefinition("_qt_uic_executable",
qt4Uic->ImportedGetLocation(""));
} }
else else
{ {
@ -1171,7 +1175,7 @@ std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target)
targetName.c_str()); targetName.c_str());
return std::string(); return std::string();
} }
return qt5Rcc->GetLocation(""); return qt5Rcc->ImportedGetLocation("");
} }
else if (strcmp(qtVersion, "4") == 0) else if (strcmp(qtVersion, "4") == 0)
{ {
@ -1182,7 +1186,7 @@ std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target)
targetName.c_str()); targetName.c_str());
return std::string(); return std::string();
} }
return qt4Rcc->GetLocation(""); return qt4Rcc->ImportedGetLocation("");
} }
cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and "

View File

@ -2753,6 +2753,15 @@ const char* cmTarget::GetLocation(const std::string& config) const
return location.c_str(); return location.c_str();
} }
//----------------------------------------------------------------------------
const char* cmTarget::ImportedGetLocation(const std::string& config) const
{
static std::string location;
assert(this->IsImported());
location = this->ImportedGetFullPath(config, false);
return location.c_str();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmTarget::GetLocationForBuild() const const char* cmTarget::GetLocationForBuild() const
{ {

View File

@ -377,6 +377,7 @@ public:
/** Get the location of the target in the build tree for the given /** Get the location of the target in the build tree for the given
configuration. */ configuration. */
const char* GetLocation(const std::string& config) const; const char* GetLocation(const std::string& config) const;
const char* ImportedGetLocation(const std::string& config) const;
/** Get the location of the target in the build tree with a placeholder /** Get the location of the target in the build tree with a placeholder
referencing the configuration in the native build system. This referencing the configuration in the native build system. This