Bläddra i källkod

cmGeneratorTarget: Add helper to check for known runtime artifact

Brad King 1 år sedan
förälder
incheckning
03d86f9d9c
2 ändrade filer med 14 tillägg och 0 borttagningar
  1. 13 0
      Source/cmGeneratorTarget.cxx
  2. 1 0
      Source/cmGeneratorTarget.h

+ 13 - 0
Source/cmGeneratorTarget.cxx

@@ -1258,6 +1258,19 @@ bool cmGeneratorTarget::CanCompileSources() const
   return this->Target->CanCompileSources();
 }
 
+bool cmGeneratorTarget::HasKnownRuntimeArtifactLocation(
+  std::string const& config) const
+{
+  if (!this->IsRuntimeBinary()) {
+    return false;
+  }
+  if (!this->IsImported()) {
+    return true;
+  }
+  ImportInfo const* info = this->GetImportInfo(config);
+  return info && !info->Location.empty();
+}
+
 const std::string& cmGeneratorTarget::GetLocationForBuild() const
 {
   static std::string location;

+ 1 - 0
Source/cmGeneratorTarget.h

@@ -58,6 +58,7 @@ public:
   bool IsImported() const;
   bool IsImportedGloballyVisible() const;
   bool CanCompileSources() const;
+  bool HasKnownRuntimeArtifactLocation(std::string const& config) const;
   const std::string& GetLocation(const std::string& config) const;
 
   /** Get the full path to the target's main artifact, if known.  */