浏览代码

cmGeneratorTarget: Move ImportedGetLocation from cmTarget.

Stephen Kelly 10 年之前
父节点
当前提交
a892b285f8
共有 5 个文件被更改,包括 27 次插入17 次删除
  1. 10 0
      Source/cmGeneratorTarget.cxx
  2. 2 0
      Source/cmGeneratorTarget.h
  3. 15 6
      Source/cmQtAutoGeneratorInitializer.cxx
  4. 0 9
      Source/cmTarget.cxx
  5. 0 2
      Source/cmTarget.h

+ 10 - 0
Source/cmGeneratorTarget.cxx

@@ -3343,6 +3343,16 @@ std::string cmGeneratorTarget::GetFullNameInternal(const std::string& config,
   return prefix+base+suffix;
 }
 
+//----------------------------------------------------------------------------
+const char*
+cmGeneratorTarget::ImportedGetLocation(const std::string& config) const
+{
+  static std::string location;
+  assert(this->IsImported());
+  location = this->Target->ImportedGetFullPath(config, false);
+  return location.c_str();
+}
+
 //----------------------------------------------------------------------------
 std::string cmGeneratorTarget::GetFullNameImported(const std::string& config,
                                                    bool implib) const

+ 2 - 0
Source/cmGeneratorTarget.h

@@ -443,6 +443,8 @@ public:
       no soname at all.  */
   bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
 
+  const char* ImportedGetLocation(const std::string& config) const;
+
 private:
   friend class cmTargetTraceDependencies;
   struct SourceEntry { std::vector<cmSourceFile*> Depends; };

+ 15 - 6
Source/cmQtAutoGeneratorInitializer.cxx

@@ -132,6 +132,7 @@ static void SetupAutoMocTarget(cmGeneratorTarget const* target,
                           std::map<std::string, std::string> &configIncludes,
                           std::map<std::string, std::string> &configDefines)
 {
+  cmLocalGenerator* lg = target->GetLocalGenerator();
   cmMakefile* makefile = target->Target->GetMakefile();
 
   const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
@@ -188,7 +189,8 @@ static void SetupAutoMocTarget(cmGeneratorTarget const* target,
   const char *qtVersion = makefile->GetDefinition("_target_qt_version");
   if (strcmp(qtVersion, "5") == 0)
     {
-    cmTarget *qt5Moc = makefile->FindTargetToUse("Qt5::moc");
+    cmGeneratorTarget *qt5Moc =
+        lg->FindGeneratorTargetToUse("Qt5::moc");
     if (!qt5Moc)
       {
       cmSystemTools::Error("Qt5::moc target not found ",
@@ -200,7 +202,8 @@ static void SetupAutoMocTarget(cmGeneratorTarget const* target,
     }
   else if (strcmp(qtVersion, "4") == 0)
     {
-    cmTarget *qt4Moc = makefile->FindTargetToUse("Qt4::moc");
+    cmGeneratorTarget *qt4Moc =
+        lg->FindGeneratorTargetToUse("Qt4::moc");
     if (!qt4Moc)
       {
       cmSystemTools::Error("Qt4::moc target not found ",
@@ -230,6 +233,7 @@ static void SetupAutoUicTarget(cmGeneratorTarget const* target,
                           std::vector<std::string> const& skipUic,
                           std::map<std::string, std::string> &configUicOptions)
 {
+  cmLocalGenerator* lg = target->GetLocalGenerator();
   cmMakefile *makefile = target->Target->GetMakefile();
 
   std::set<std::string> skipped;
@@ -303,7 +307,8 @@ static void SetupAutoUicTarget(cmGeneratorTarget const* target,
   std::string targetName = target->GetName();
   if (strcmp(qtVersion, "5") == 0)
     {
-    cmTarget *qt5Uic = makefile->FindTargetToUse("Qt5::uic");
+    cmGeneratorTarget *qt5Uic =
+        lg->FindGeneratorTargetToUse("Qt5::uic");
     if (!qt5Uic)
       {
       // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
@@ -316,7 +321,8 @@ static void SetupAutoUicTarget(cmGeneratorTarget const* target,
     }
   else if (strcmp(qtVersion, "4") == 0)
     {
-    cmTarget *qt4Uic = makefile->FindTargetToUse("Qt4::uic");
+    cmGeneratorTarget *qt4Uic =
+        lg->FindGeneratorTargetToUse("Qt4::uic");
     if (!qt4Uic)
       {
       cmSystemTools::Error("Qt4::uic target not found ",
@@ -335,6 +341,7 @@ static void SetupAutoUicTarget(cmGeneratorTarget const* target,
 
 static std::string GetRccExecutable(cmGeneratorTarget const* target)
 {
+  cmLocalGenerator* lg = target->GetLocalGenerator();
   cmMakefile *makefile = target->Target->GetMakefile();
   const char *qtVersion = makefile->GetDefinition("_target_qt_version");
   if (!qtVersion)
@@ -355,7 +362,8 @@ static std::string GetRccExecutable(cmGeneratorTarget const* target)
   std::string targetName = target->GetName();
   if (strcmp(qtVersion, "5") == 0)
     {
-    cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc");
+    cmGeneratorTarget *qt5Rcc =
+        lg->FindGeneratorTargetToUse("Qt5::rcc");
     if (!qt5Rcc)
       {
       cmSystemTools::Error("Qt5::rcc target not found ",
@@ -366,7 +374,8 @@ static std::string GetRccExecutable(cmGeneratorTarget const* target)
     }
   else if (strcmp(qtVersion, "4") == 0)
     {
-    cmTarget *qt4Rcc = makefile->FindTargetToUse("Qt4::rcc");
+    cmGeneratorTarget *qt4Rcc =
+        lg->FindGeneratorTargetToUse("Qt4::rcc");
     if (!qt4Rcc)
       {
       cmSystemTools::Error("Qt4::rcc target not found ",

+ 0 - 9
Source/cmTarget.cxx

@@ -1627,15 +1627,6 @@ bool cmTarget::HaveWellDefinedOutputFiles() const
     this->GetType() == cmState::EXECUTABLE;
 }
 
-//----------------------------------------------------------------------------
-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();
-}
-
 //----------------------------------------------------------------------------
 void cmTarget::GetTargetVersion(int& major, int& minor) const
 {

+ 0 - 2
Source/cmTarget.h

@@ -217,8 +217,6 @@ public:
       the link dependencies of this target.  */
   std::string CheckCMP0004(std::string const& item) const;
 
-  const char* ImportedGetLocation(const std::string& config) const;
-
   /** Get the target major and minor version numbers interpreted from
       the VERSION property.  Version 0 is returned if the property is
       not set or cannot be parsed.  */