瀏覽代碼

cmGeneratorTarget: return the source file added

A few callsites uses this codepath to generate `cmSourceFile` instances;
allow them to access it.
Ben Boeckel 2 月之前
父節點
當前提交
388923818d
共有 2 個文件被更改,包括 4 次插入3 次删除
  1. 3 2
      Source/cmGeneratorTarget.cxx
  2. 1 1
      Source/cmGeneratorTarget.h

+ 3 - 2
Source/cmGeneratorTarget.cxx

@@ -566,10 +566,11 @@ void cmGeneratorTarget::AddSourceCommon(std::string const& src, bool before)
   this->ClearSourcesCache();
 }
 
-void cmGeneratorTarget::AddSource(std::string const& src, bool before)
+cmSourceFile* cmGeneratorTarget::AddSource(std::string const& src, bool before)
 {
-  this->Target->AddSource(src, before);
+  auto* sf = this->Target->AddSource(src, before);
   this->AddSourceCommon(src, before);
+  return sf;
 }
 
 void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs)

+ 1 - 1
Source/cmGeneratorTarget.h

@@ -845,7 +845,7 @@ public:
    */
   void ClearLinkInterfaceCache();
 
-  void AddSource(std::string const& src, bool before = false);
+  cmSourceFile* AddSource(std::string const& src, bool before = false);
   void AddTracedSources(std::vector<std::string> const& srcs);
 
   /**