瀏覽代碼

ENH: Define target-specific support directories

This creates method cmTarget::GetSupportDirectory to compute a
target-specific support directory in the build tree.  It uses the
"CMakeFiles/<name>.dir" convention already used by the Makefile
generators.  The method will be useful for any code that needs to
generate per-target information into the build tree for use by CMake
tools that do not run at generate time.
Brad King 17 年之前
父節點
當前提交
d0ed46e3d6
共有 2 個文件被更改,包括 14 次插入0 次删除
  1. 11 0
      Source/cmTarget.cxx
  2. 3 0
      Source/cmTarget.h

+ 11 - 0
Source/cmTarget.cxx

@@ -865,6 +865,17 @@ cmListFileBacktrace const& cmTarget::GetBacktrace() const
   return this->Internal->Backtrace;
 }
 
+//----------------------------------------------------------------------------
+std::string cmTarget::GetSupportDirectory() const
+{
+  std::string dir = this->Makefile->GetCurrentOutputDirectory();
+  dir += cmake::GetCMakeFilesDirectory();
+  dir += "/";
+  dir += this->Name;
+  dir += ".dir";
+  return dir;
+}
+
 //----------------------------------------------------------------------------
 bool cmTarget::IsExecutableWithExports()
 {

+ 3 - 0
Source/cmTarget.h

@@ -415,6 +415,9 @@ public:
   /** Get a backtrace from the creation of the target.  */
   cmListFileBacktrace const& GetBacktrace() const;
 
+  /** Get a build-tree directory in which to place target support files.  */
+  std::string GetSupportDirectory() const;
+
 private:
   /**
    * A list of direct dependencies. Use in conjunction with DependencyMap.