浏览代码

cmTarget: Simplify ClearDependencyInformation implementation

Remove the `<target>_LIB_DEPENDS` cache entry unconditionally.
It will be populated again later if needed.  There is no need
to ask the user to remove the cache entry if the target type
changes.

Issue: #16364
Brad King 7 年之前
父节点
当前提交
1c5bfab532
共有 1 个文件被更改,包括 1 次插入16 次删除
  1. 1 16
      Source/cmTarget.cxx

+ 1 - 16
Source/cmTarget.cxx

@@ -637,24 +637,9 @@ const std::vector<std::string>& cmTarget::GetLinkDirectories() const
 
 void cmTarget::ClearDependencyInformation(cmMakefile& mf)
 {
-  // Clear the dependencies. The cache variable must exist iff we are
-  // recording dependency information for this target.
   std::string depname = this->GetName();
   depname += "_LIB_DEPENDS";
-  if (this->RecordDependencies) {
-    mf.AddCacheDefinition(depname, "", "Dependencies for target",
-                          cmStateEnums::STATIC);
-  } else {
-    if (mf.GetDefinition(depname)) {
-      std::string message = "Target ";
-      message += this->GetName();
-      message += " has dependency information when it shouldn't.\n";
-      message += "Your cache is probably stale. Please remove the entry\n  ";
-      message += depname;
-      message += "\nfrom the cache.";
-      cmSystemTools::Error(message.c_str());
-    }
-  }
+  mf.RemoveCacheDefinition(depname);
 }
 
 std::string cmTarget::GetDebugGeneratorExpressions(