Merge topic 'avoid-LIB_DEPENDS'

7723e9a058 Do not produce legacy _LIB_DEPENDS cache entries
2124a1364a cmTarget: Remove unnecessary RecordDependencies member
1c5bfab532 cmTarget: Simplify ClearDependencyInformation implementation
910a9d608e cmTarget: Simplify ClearDependencyInformation signature

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Pavel Solodovnikov <hellyeahdominate@gmail.com>
Merge-request: !1828
This commit is contained in:
Brad King
2018-03-08 14:54:38 +00:00
committed by Kitware Robot
12 changed files with 77 additions and 33 deletions
+1 -1
View File
@@ -1867,7 +1867,7 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname,
// Clear its dependencies. Otherwise, dependencies might persist
// over changes in CMakeLists.txt, making the information stale and
// hence useless.
target->ClearDependencyInformation(*this, lname);
target->ClearDependencyInformation(*this);
if (excludeFromAll) {
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
+5 -1
View File
@@ -214,6 +214,9 @@ class cmMakefile;
3, 10, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0072, \
"FindOpenGL prefers GLVND by default when available.", 3, 11, 0, \
cmPolicies::WARN) \
SELECT(POLICY, CMP0073, \
"Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0, \
cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
@@ -238,7 +241,8 @@ class cmMakefile;
F(CMP0063) \
F(CMP0065) \
F(CMP0068) \
F(CMP0069)
F(CMP0069) \
F(CMP0073)
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies
+8 -29
View File
@@ -186,14 +186,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->ImportedGloballyVisible = vis == VisibilityImportedGlobally;
this->BuildInterfaceIncludesAppended = false;
// only add dependency information for library targets
if (this->TargetTypeValue >= cmStateEnums::STATIC_LIBRARY &&
this->TargetTypeValue <= cmStateEnums::MODULE_LIBRARY) {
this->RecordDependencies = true;
} else {
this->RecordDependencies = false;
}
// Check whether this is a DLL platform.
this->DLLPlatform =
(this->Makefile->IsOn("WIN32") || this->Makefile->IsOn("CYGWIN") ||
@@ -635,27 +627,11 @@ const std::vector<std::string>& cmTarget::GetLinkDirectories() const
return this->LinkDirectories;
}
void cmTarget::ClearDependencyInformation(cmMakefile& mf,
const std::string& target)
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 = 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 += target;
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(
@@ -752,7 +728,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib,
this->OriginalLinkLibraries.emplace_back(lib, llt);
}
// Add the explicit dependency information for this target. This is
// Add the explicit dependency information for libraries. This is
// simply a set of libraries separated by ";". There should always
// be a trailing ";". These library names are not canonical, in that
// they may be "-framework x", "-ly", "/path/libz.a", etc.
@@ -760,7 +736,10 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib,
// may be purposefully duplicated to handle recursive dependencies,
// and we removing one instance will break the link line. Duplicates
// will be appropriately eliminated at emit time.
if (this->RecordDependencies) {
if (this->TargetTypeValue >= cmStateEnums::STATIC_LIBRARY &&
this->TargetTypeValue <= cmStateEnums::MODULE_LIBRARY &&
(this->GetPolicyStatusCMP0073() == cmPolicies::OLD ||
this->GetPolicyStatusCMP0073() == cmPolicies::WARN)) {
std::string targetEntry = this->Name;
targetEntry += "_LIB_DEPENDS";
std::string dependencies;
+1 -2
View File
@@ -137,7 +137,7 @@ public:
/**
* Clear the dependency information recorded for this target, if any.
*/
void ClearDependencyInformation(cmMakefile& mf, const std::string& target);
void ClearDependencyInformation(cmMakefile& mf);
void AddLinkLibrary(cmMakefile& mf, const std::string& lib,
cmTargetLinkLibraryType llt);
@@ -310,7 +310,6 @@ private:
cmTargetInternalPointer Internal;
cmStateEnums::TargetType TargetTypeValue;
bool HaveInstallRule;
bool RecordDependencies;
bool DLLPlatform;
bool IsAndroid;
bool IsImportedTarget;