From 5b60eaf619baf4dfa2bc1a3f1109ff742a04f532 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 10 Mar 2014 14:42:27 +0100 Subject: 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. --- Source/cmQtAutoGenerators.cxx | 16 ++++++++++------ Source/cmTarget.cxx | 9 +++++++++ Source/cmTarget.h | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index ae21561..979db91 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -809,7 +809,8 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, autogenTargetName.c_str()); return; } - makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation("")); + makefile->AddDefinition("_qt_moc_executable", + qt5Moc->ImportedGetLocation("")); } else if (strcmp(qtVersion, "4") == 0) { @@ -820,7 +821,8 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, autogenTargetName.c_str()); return; } - makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation("")); + makefile->AddDefinition("_qt_moc_executable", + qt4Moc->ImportedGetLocation("")); } else { @@ -967,7 +969,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } else { - makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation("")); + makefile->AddDefinition("_qt_uic_executable", + qt5Uic->ImportedGetLocation("")); } } else if (strcmp(qtVersion, "4") == 0) @@ -979,7 +982,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, targetName.c_str()); return; } - makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation("")); + makefile->AddDefinition("_qt_uic_executable", + qt4Uic->ImportedGetLocation("")); } else { @@ -1171,7 +1175,7 @@ std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target) targetName.c_str()); return std::string(); } - return qt5Rcc->GetLocation(""); + return qt5Rcc->ImportedGetLocation(""); } else if (strcmp(qtVersion, "4") == 0) { @@ -1182,7 +1186,7 @@ std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target) targetName.c_str()); return std::string(); } - return qt4Rcc->GetLocation(""); + return qt4Rcc->ImportedGetLocation(""); } cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 295c862..e4cd4f3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2754,6 +2754,15 @@ const char* cmTarget::GetLocation(const std::string& config) const } //---------------------------------------------------------------------------- +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 { static std::string location; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 1920312..a0198e2 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -377,6 +377,7 @@ public: /** Get the location of the target in the build tree for the given configuration. */ 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 referencing the configuration in the native build system. This -- cgit v0.12