瀏覽代碼

cmTarget: Find source files on request.

In a follow-up, the list of sources will become dependent on
the config, so check for existence in cmTarget::GetSourceFiles
instead of up-front with cmGlobalGenerator::CheckTargets().
Stephen Kelly 11 年之前
父節點
當前提交
f81eb49e8b
共有 4 個文件被更改,包括 4 次插入51 次删除
  1. 0 35
      Source/cmGlobalGenerator.cxx
  2. 0 1
      Source/cmGlobalGenerator.h
  3. 4 10
      Source/cmTarget.cxx
  4. 0 5
      Source/cmTarget.h

+ 0 - 35
Source/cmGlobalGenerator.cxx

@@ -1148,12 +1148,6 @@ void cmGlobalGenerator::Generate()
     return;
     }
 
-  // Check that all targets are valid.
-  if(!this->CheckTargets())
-    {
-    return;
-    }
-
   this->FinalizeTargetCompileInfo();
 
 #ifdef CMAKE_BUILD_WITH_CMAKE
@@ -1305,35 +1299,6 @@ bool cmGlobalGenerator::ComputeTargetDepends()
   return true;
 }
 
-//----------------------------------------------------------------------------
-bool cmGlobalGenerator::CheckTargets()
-{
-  // Make sure all targets can find their source files.
-  for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
-    {
-    cmTargets& targets =
-      this->LocalGenerators[i]->GetMakefile()->GetTargets();
-    for(cmTargets::iterator ti = targets.begin();
-        ti != targets.end(); ++ti)
-      {
-      cmTarget& target = ti->second;
-      if(target.GetType() == cmTarget::EXECUTABLE ||
-         target.GetType() == cmTarget::STATIC_LIBRARY ||
-         target.GetType() == cmTarget::SHARED_LIBRARY ||
-         target.GetType() == cmTarget::MODULE_LIBRARY ||
-         target.GetType() == cmTarget::OBJECT_LIBRARY ||
-         target.GetType() == cmTarget::UTILITY)
-        {
-        if(!target.FindSourceFiles())
-          {
-          return false;
-          }
-        }
-      }
-    }
-  return true;
-}
-
 //----------------------------------------------------------------------------
 void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
 {

+ 0 - 1
Source/cmGlobalGenerator.h

@@ -340,7 +340,6 @@ protected:
 
   virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const;
 
-  bool CheckTargets();
   typedef std::vector<std::pair<cmQtAutoGenerators,
                                 cmTarget const*> > AutogensType;
   void CreateQtAutoGeneratorsTargets(AutogensType& autogens);

+ 4 - 10
Source/cmTarget.cxx

@@ -522,10 +522,11 @@ bool cmTarget::IsBundleOnApple() const
 }
 
 //----------------------------------------------------------------------------
-bool cmTarget::FindSourceFiles()
+void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files) const
 {
+  assert(this->GetType() != INTERFACE_LIBRARY);
   for(std::vector<cmSourceFile*>::const_iterator
-        si = this->SourceFiles.begin();
+      si = this->SourceFiles.begin();
       si != this->SourceFiles.end(); ++si)
     {
     std::string e;
@@ -537,16 +538,9 @@ bool cmTarget::FindSourceFiles()
         cm->IssueMessage(cmake::FATAL_ERROR, e,
                          this->GetBacktrace());
         }
-      return false;
+      return;
       }
     }
-  return true;
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files) const
-{
-  assert(this->GetType() != INTERFACE_LIBRARY);
   files = this->SourceFiles;
 }
 

+ 0 - 5
Source/cmTarget.h

@@ -330,11 +330,6 @@ public:
   void
   GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
 
-  /**
-   * Make sure the full path to all source files is known.
-   */
-  bool FindSourceFiles();
-
   ///! Return the preferred linker language for this target
   const char* GetLinkerLanguage(const char* config = 0,
                                 cmTarget const* head = 0) const;