From 8391b3015a82909828b7ada98e76d45aa11b892b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:32 +0200 Subject: cmTarget: Add assert about link data MergeLinkLibraries is called only from cmMakefile::AddGlobalLinkInformation which is only called immediately after creating a target. --- Source/cmTarget.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 13a4744..28ef04a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -479,6 +479,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) void cmTarget::MergeLinkLibraries(cmMakefile& mf, const std::string& selfname, const LinkLibraryVectorType& libs) { + assert(this->PrevLinkedLibraries.empty()); // Only add on libraries we haven't added on before. // Assumption: the global link libraries could only grow, never shrink LinkLibraryVectorType::const_iterator i = libs.begin(); -- cgit v0.12 From 9a1d4e4ba170f4ac34c80593bd2fe8e1481a1181 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:33 +0200 Subject: cmTarget: Remove addition of zero when merging link libraries The size is always zero when this is called. --- Source/cmTarget.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 28ef04a..5b878d3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -483,7 +483,6 @@ void cmTarget::MergeLinkLibraries(cmMakefile& mf, const std::string& selfname, // Only add on libraries we haven't added on before. // Assumption: the global link libraries could only grow, never shrink LinkLibraryVectorType::const_iterator i = libs.begin(); - i += this->PrevLinkedLibraries.size(); for (; i != libs.end(); ++i) { // This is equivalent to the target_link_libraries plain signature. this->AddLinkLibrary(mf, selfname, i->first, i->second); -- cgit v0.12 From 2232e97a6ed4a338b814d1ba3d62a7ffa9ef6e7f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:33 +0200 Subject: cmTarget: Remove useless link library state --- Source/cmTarget.cxx | 4 ---- Source/cmTarget.h | 1 - 2 files changed, 5 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5b878d3..0e7e2a5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -479,9 +479,6 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) void cmTarget::MergeLinkLibraries(cmMakefile& mf, const std::string& selfname, const LinkLibraryVectorType& libs) { - assert(this->PrevLinkedLibraries.empty()); - // Only add on libraries we haven't added on before. - // Assumption: the global link libraries could only grow, never shrink LinkLibraryVectorType::const_iterator i = libs.begin(); for (; i != libs.end(); ++i) { // This is equivalent to the target_link_libraries plain signature. @@ -490,7 +487,6 @@ void cmTarget::MergeLinkLibraries(cmMakefile& mf, const std::string& selfname, "INTERFACE_LINK_LIBRARIES", this->GetDebugGeneratorExpressions(i->first, i->second).c_str()); } - this->PrevLinkedLibraries = libs; } void cmTarget::AddLinkDirectory(const std::string& d) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index dd9097a..f062529 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -299,7 +299,6 @@ private: std::vector PreLinkCommands; std::vector PostBuildCommands; std::vector > TLLCommands; - LinkLibraryVectorType PrevLinkedLibraries; LinkLibraryVectorType OriginalLinkLibraries; cmMakefile* Makefile; cmTargetInternalPointer Internal; -- cgit v0.12 From 3b4895fa35e4a96022abd99b07002a7d2ab3a968 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:33 +0200 Subject: cmTarget: Inline MergeLinkLibraries into only caller --- Source/cmMakefile.cxx | 11 ++++++++++- Source/cmTarget.cxx | 13 ------------- Source/cmTarget.h | 3 --- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index df993ce..c022b44 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1863,7 +1863,16 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name, } } } - target.MergeLinkLibraries(*this, name, this->LinkLibraries); + + cmTarget::LinkLibraryVectorType::const_iterator i = + this->LinkLibraries.begin(); + for (; i != this->LinkLibraries.end(); ++i) { + // This is equivalent to the target_link_libraries plain signature. + target.AddLinkLibrary(*this, name, i->first, i->second); + target.AppendProperty( + "INTERFACE_LINK_LIBRARIES", + target.GetDebugGeneratorExpressions(i->first, i->second).c_str()); + } } void cmMakefile::AddAlias(const std::string& lname, std::string const& tgtName) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0e7e2a5..86a2777 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -476,19 +476,6 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) return this->Makefile->GetOrCreateSource(src); } -void cmTarget::MergeLinkLibraries(cmMakefile& mf, const std::string& selfname, - const LinkLibraryVectorType& libs) -{ - LinkLibraryVectorType::const_iterator i = libs.begin(); - for (; i != libs.end(); ++i) { - // This is equivalent to the target_link_libraries plain signature. - this->AddLinkLibrary(mf, selfname, i->first, i->second); - this->AppendProperty( - "INTERFACE_LINK_LIBRARIES", - this->GetDebugGeneratorExpressions(i->first, i->second).c_str()); - } -} - void cmTarget::AddLinkDirectory(const std::string& d) { // Make sure we don't add unnecessary search directories. diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f062529..8fbb42f 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -153,9 +153,6 @@ public: cmListFileContext const& lfc); void GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const; - void MergeLinkLibraries(cmMakefile& mf, const std::string& selfname, - const LinkLibraryVectorType& libs); - const std::vector& GetLinkDirectories() const; void AddLinkDirectory(const std::string& d); -- cgit v0.12 From 3e8d47d18b4db6b4621ee5e4864dde234ad8a282 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:33 +0200 Subject: cmMakefile: Remove useless link directory container It is never populated - a find will never find anything. --- Source/cmMakefile.cxx | 5 +---- Source/cmMakefile.h | 3 --- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c022b44..0efd92c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1857,10 +1857,7 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name, if (*j->rbegin() == '/') { newdir = j->substr(0, j->size() - 1); } - if (std::find(this->LinkDirectories.begin(), this->LinkDirectories.end(), - newdir) == this->LinkDirectories.end()) { - target.AddLinkDirectory(*j); - } + target.AddLinkDirectory(*j); } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 40344ce..92907cd 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -805,9 +805,6 @@ protected: // Tests std::map Tests; - // The link-library paths. Order matters, use std::vector (not std::set). - std::vector LinkDirectories; - // The set of include directories that are marked as system include // directories. std::set SystemIncludeDirectories; -- cgit v0.12 From c8ec8d6a7ec6c176bc14e7026dc755a9be8689cb Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:34 +0200 Subject: cmMakefile: Remove superfluous overload Explicit is better than implicit. --- Source/cmLinkLibrariesCommand.cxx | 2 +- Source/cmMakefile.cxx | 5 ----- Source/cmMakefile.h | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index bb0e27b..3fc7bd9 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -30,7 +30,7 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector const& args, } this->Makefile->AddLinkLibrary(*i, OPTIMIZED_LibraryType); } else { - this->Makefile->AddLinkLibrary(*i); + this->Makefile->AddLinkLibrary(*i, GENERAL_LibraryType); } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0efd92c..3e9837d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1267,11 +1267,6 @@ void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, } } -void cmMakefile::AddLinkLibrary(const std::string& lib) -{ - this->AddLinkLibrary(lib, GENERAL_LibraryType); -} - void cmMakefile::InitializeFromParent(cmMakefile* parent) { this->SystemIncludeDirectories = parent->SystemIncludeDirectories; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 92907cd..9ffdd9d 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -199,7 +199,6 @@ public: /** * Add a link library to the build. */ - void AddLinkLibrary(const std::string&); void AddLinkLibrary(const std::string&, cmTargetLinkLibraryType type); void AddLinkLibraryForTarget(const std::string& tgt, const std::string&, cmTargetLinkLibraryType type); -- cgit v0.12 From 4d039c5b46e3cac29ff1d9ce3e768af1bca6b69a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:34 +0200 Subject: cmMakefile: Invert handling of error condition --- Source/cmMakefile.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3e9837d..7c4a2c2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1221,7 +1221,12 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, cmTargetLinkLibraryType llt) { cmTargets::iterator i = this->Targets.find(target); - if (i != this->Targets.end()) { + if (i == this->Targets.end()) { + std::ostringstream e; + e << "Attempt to add link library \"" << lib << "\" to target \"" << target + << "\" which is not built in this directory."; + this->IssueMessage(cmake::FATAL_ERROR, e.str()); + } else { cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib); if (tgt) { // if it is not a static or shared library then you can not link to it @@ -1239,11 +1244,6 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, } } i->second.AddLinkLibrary(*this, target, lib, llt); - } else { - std::ostringstream e; - e << "Attempt to add link library \"" << lib << "\" to target \"" << target - << "\" which is not built in this directory."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); } } -- cgit v0.12 From 4457a9f181663701961dc209740974f48213e6e7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:34 +0200 Subject: cmMakefile: Return after error and remove else condition --- Source/cmMakefile.cxx | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c4a2c2..f4ea8a9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1226,25 +1226,26 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, e << "Attempt to add link library \"" << lib << "\" to target \"" << target << "\" which is not built in this directory."; this->IssueMessage(cmake::FATAL_ERROR, e.str()); - } else { - cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib); - if (tgt) { - // if it is not a static or shared library then you can not link to it - if (!((tgt->GetType() == cmState::STATIC_LIBRARY) || - (tgt->GetType() == cmState::SHARED_LIBRARY) || - (tgt->GetType() == cmState::INTERFACE_LIBRARY) || - tgt->IsExecutableWithExports())) { - std::ostringstream e; - e << "Target \"" << lib << "\" of type " - << cmState::GetTargetTypeName(tgt->GetType()) - << " may not be linked into another target. " - << "One may link only to STATIC or SHARED libraries, or " - << "to executables with the ENABLE_EXPORTS property set."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); - } + return; + } + + cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib); + if (tgt) { + // if it is not a static or shared library then you can not link to it + if (!((tgt->GetType() == cmState::STATIC_LIBRARY) || + (tgt->GetType() == cmState::SHARED_LIBRARY) || + (tgt->GetType() == cmState::INTERFACE_LIBRARY) || + tgt->IsExecutableWithExports())) { + std::ostringstream e; + e << "Target \"" << lib << "\" of type " + << cmState::GetTargetTypeName(tgt->GetType()) + << " may not be linked into another target. " + << "One may link only to STATIC or SHARED libraries, or " + << "to executables with the ENABLE_EXPORTS property set."; + this->IssueMessage(cmake::FATAL_ERROR, e.str()); } - i->second.AddLinkLibrary(*this, target, lib, llt); } + i->second.AddLinkLibrary(*this, target, lib, llt); } void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, -- cgit v0.12 From 148b83a12185d7611ff7576464087430c3f2719c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:34 +0200 Subject: cmMakefile: DeMorgan-invert condition --- Source/cmMakefile.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f4ea8a9..8716696 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1232,10 +1232,10 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib); if (tgt) { // if it is not a static or shared library then you can not link to it - if (!((tgt->GetType() == cmState::STATIC_LIBRARY) || - (tgt->GetType() == cmState::SHARED_LIBRARY) || - (tgt->GetType() == cmState::INTERFACE_LIBRARY) || - tgt->IsExecutableWithExports())) { + if ((tgt->GetType() != cmState::STATIC_LIBRARY) && + (tgt->GetType() != cmState::SHARED_LIBRARY) && + (tgt->GetType() != cmState::INTERFACE_LIBRARY) && + !tgt->IsExecutableWithExports()) { std::ostringstream e; e << "Target \"" << lib << "\" of type " << cmState::GetTargetTypeName(tgt->GetType()) -- cgit v0.12 From 2f6462a634726d9d0ea8d8552454839d67183016 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:34 +0200 Subject: cmMakefile: Collapse two consecutive if()s into one --- Source/cmMakefile.cxx | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8716696..c8446ac 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1230,20 +1230,17 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, } cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib); - if (tgt) { - // if it is not a static or shared library then you can not link to it - if ((tgt->GetType() != cmState::STATIC_LIBRARY) && - (tgt->GetType() != cmState::SHARED_LIBRARY) && - (tgt->GetType() != cmState::INTERFACE_LIBRARY) && - !tgt->IsExecutableWithExports()) { - std::ostringstream e; - e << "Target \"" << lib << "\" of type " - << cmState::GetTargetTypeName(tgt->GetType()) - << " may not be linked into another target. " - << "One may link only to STATIC or SHARED libraries, or " - << "to executables with the ENABLE_EXPORTS property set."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); - } + if (tgt && (tgt->GetType() != cmState::STATIC_LIBRARY) && + (tgt->GetType() != cmState::SHARED_LIBRARY) && + (tgt->GetType() != cmState::INTERFACE_LIBRARY) && + !tgt->IsExecutableWithExports()) { + std::ostringstream e; + e << "Target \"" << lib << "\" of type " + << cmState::GetTargetTypeName(tgt->GetType()) + << " may not be linked into another target. " + << "One may link only to STATIC or SHARED libraries, or " + << "to executables with the ENABLE_EXPORTS property set."; + this->IssueMessage(cmake::FATAL_ERROR, e.str()); } i->second.AddLinkLibrary(*this, target, lib, llt); } -- cgit v0.12 From 869037ee86d1c0ab757840adf499ea270d4301e1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:35 +0200 Subject: cmMakefile: Remove ALIAS check This method is only called from the cmPlugin API, which predates ALIAS targets and is obsolete. --- Source/cmMakefile.cxx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c8446ac..57bab7a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1250,13 +1250,6 @@ void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, { cmTargets::iterator i = this->Targets.find(target); if (i != this->Targets.end()) { - if (this->IsAlias(target)) { - std::ostringstream e; - e << "ALIAS target \"" << target << "\" " - << "may not be linked into another target."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); - return; - } i->second.AddLinkDirectory(d); } else { cmSystemTools::Error( -- cgit v0.12 From 6d98b15fc8b9a065325e3683afe94efce17dd162 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:35 +0200 Subject: cmMakefile: Invert if() condition to remove else --- Source/cmMakefile.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 57bab7a..7e26bff 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1249,13 +1249,13 @@ void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, const std::string& d) { cmTargets::iterator i = this->Targets.find(target); - if (i != this->Targets.end()) { - i->second.AddLinkDirectory(d); - } else { + if (i == this->Targets.end()) { cmSystemTools::Error( "Attempt to add link directories to non-existent target: ", target.c_str(), " for directory ", d.c_str()); + return; } + i->second.AddLinkDirectory(d); } void cmMakefile::InitializeFromParent(cmMakefile* parent) -- cgit v0.12 From 7ba954925a876f4c753a4296236bc7d2f18eb0b8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:35 +0200 Subject: cmMakefile: Use public API to find a target --- Source/cmMakefile.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7e26bff..d2be29c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1248,14 +1248,15 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, const std::string& d) { - cmTargets::iterator i = this->Targets.find(target); - if (i == this->Targets.end()) { + cmTarget* t = this->FindLocalNonAliasTarget(target); + if (!t) { cmSystemTools::Error( "Attempt to add link directories to non-existent target: ", target.c_str(), " for directory ", d.c_str()); return; } - i->second.AddLinkDirectory(d); + + t->AddLinkDirectory(d); } void cmMakefile::InitializeFromParent(cmMakefile* parent) -- cgit v0.12 From 2b7baed719e4a6eb918ed6f22ee6031a40b7f316 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:35 +0200 Subject: cmMakefile: Inline method into only caller cmMakefile should not have API which is only useful for deprecated systems like cmPluginAPI. --- Source/cmCPluginAPI.cxx | 9 ++++++++- Source/cmMakefile.cxx | 14 -------------- Source/cmMakefile.h | 1 - 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 3a08aea..2498ecb 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -162,7 +162,14 @@ void CCONV cmAddLinkDirectoryForTarget(void* arg, const char* tgt, const char* d) { cmMakefile* mf = static_cast(arg); - mf->AddLinkDirectoryForTarget(tgt, d); + cmTarget* t = mf->FindLocalNonAliasTarget(tgt); + if (!t) { + cmSystemTools::Error( + "Attempt to add link directories to non-existent target: ", tgt, + " for directory ", d); + return; + } + t->AddLinkDirectory(d); } void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs, diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d2be29c..f2db37e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1245,20 +1245,6 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, i->second.AddLinkLibrary(*this, target, lib, llt); } -void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, - const std::string& d) -{ - cmTarget* t = this->FindLocalNonAliasTarget(target); - if (!t) { - cmSystemTools::Error( - "Attempt to add link directories to non-existent target: ", - target.c_str(), " for directory ", d.c_str()); - return; - } - - t->AddLinkDirectory(d); -} - void cmMakefile::InitializeFromParent(cmMakefile* parent) { this->SystemIncludeDirectories = parent->SystemIncludeDirectories; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 9ffdd9d..76afcbc 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -202,7 +202,6 @@ public: void AddLinkLibrary(const std::string&, cmTargetLinkLibraryType type); void AddLinkLibraryForTarget(const std::string& tgt, const std::string&, cmTargetLinkLibraryType type); - void AddLinkDirectoryForTarget(const std::string& tgt, const std::string& d); /** * Add a subdirectory to the build. -- cgit v0.12 From 1c70c6cc09f0f8be087db2aeae5ee6a3f1b47bda Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:35 +0200 Subject: cmMakefile: Use public API to find a target --- Source/cmMakefile.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f2db37e..ae2d776 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1220,8 +1220,8 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, const std::string& lib, cmTargetLinkLibraryType llt) { - cmTargets::iterator i = this->Targets.find(target); - if (i == this->Targets.end()) { + cmTarget* t = this->FindLocalNonAliasTarget(target); + if (!t) { std::ostringstream e; e << "Attempt to add link library \"" << lib << "\" to target \"" << target << "\" which is not built in this directory."; @@ -1242,7 +1242,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, << "to executables with the ENABLE_EXPORTS property set."; this->IssueMessage(cmake::FATAL_ERROR, e.str()); } - i->second.AddLinkLibrary(*this, target, lib, llt); + t->AddLinkLibrary(*this, target, lib, llt); } void cmMakefile::InitializeFromParent(cmMakefile* parent) -- cgit v0.12 From d9b5f0a301c23c2c0e56ad3fcb696de71c3d6365 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:36 +0200 Subject: cmTarget: Remove target name from parameter list Use the member state instead. --- Source/cmMakefile.cxx | 6 +++--- Source/cmTarget.cxx | 7 +++---- Source/cmTarget.h | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ae2d776..4763d83 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1242,7 +1242,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, << "to executables with the ENABLE_EXPORTS property set."; this->IssueMessage(cmake::FATAL_ERROR, e.str()); } - t->AddLinkLibrary(*this, target, lib, llt); + t->AddLinkLibrary(*this, lib, llt); } void cmMakefile::InitializeFromParent(cmMakefile* parent) @@ -1808,7 +1808,7 @@ void cmMakefile::SetProjectName(std::string const& p) this->StateSnapshot.SetProjectName(p); } -void cmMakefile::AddGlobalLinkInformation(const std::string& name, +void cmMakefile::AddGlobalLinkInformation(const std::string& /* name */, cmTarget& target) { // for these targets do not add anything @@ -1838,7 +1838,7 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name, this->LinkLibraries.begin(); for (; i != this->LinkLibraries.end(); ++i) { // This is equivalent to the target_link_libraries plain signature. - target.AddLinkLibrary(*this, name, i->first, i->second); + target.AddLinkLibrary(*this, i->first, i->second); target.AppendProperty( "INTERFACE_LINK_LIBRARIES", target.GetDebugGeneratorExpressions(i->first, i->second).c_str()); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 86a2777..651bcc8 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -578,8 +578,7 @@ void cmTarget::GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const } } -void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& target, - const std::string& lib, +void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib, cmTargetLinkLibraryType llt) { cmTarget* tgt = this->Makefile->FindTargetToUse(lib); @@ -597,7 +596,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& target, if (cmGeneratorExpression::Find(lib) != std::string::npos || (tgt && tgt->GetType() == cmState::INTERFACE_LIBRARY) || - (target == lib)) { + (this->Name == lib)) { return; } @@ -615,7 +614,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& target, // and we removing one instance will break the link line. Duplicates // will be appropriately eliminated at emit time. if (this->RecordDependencies) { - std::string targetEntry = target; + std::string targetEntry = this->Name; targetEntry += "_LIB_DEPENDS"; std::string dependencies; const char* old_val = mf.GetDefinition(targetEntry); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 8fbb42f..3d88688 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -142,8 +142,8 @@ public: */ void ClearDependencyInformation(cmMakefile& mf, const std::string& target); - void AddLinkLibrary(cmMakefile& mf, const std::string& target, - const std::string& lib, cmTargetLinkLibraryType llt); + void AddLinkLibrary(cmMakefile& mf, const std::string& lib, + cmTargetLinkLibraryType llt); enum TLLSignature { KeywordTLLSignature, -- cgit v0.12 From 1efca9f427a5c537afc034aadf0c29073bfdfa22 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:36 +0200 Subject: cmMakefile: Remove obsolete parameter --- Source/cmMakefile.cxx | 7 +++---- Source/cmMakefile.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4763d83..eda08c0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1808,8 +1808,7 @@ void cmMakefile::SetProjectName(std::string const& p) this->StateSnapshot.SetProjectName(p); } -void cmMakefile::AddGlobalLinkInformation(const std::string& /* name */, - cmTarget& target) +void cmMakefile::AddGlobalLinkInformation(cmTarget& target) { // for these targets do not add anything switch (target.GetType()) { @@ -1874,7 +1873,7 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname, target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } target->AddSources(srcs); - this->AddGlobalLinkInformation(lname, *target); + this->AddGlobalLinkInformation(*target); return target; } @@ -1887,7 +1886,7 @@ cmTarget* cmMakefile::AddExecutable(const char* exeName, target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } target->AddSources(srcs); - this->AddGlobalLinkInformation(exeName, *target); + this->AddGlobalLinkInformation(*target); return target; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 76afcbc..9f5f8ee 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -779,7 +779,7 @@ public: protected: // add link libraries and directories to the target - void AddGlobalLinkInformation(const std::string& name, cmTarget& target); + void AddGlobalLinkInformation(cmTarget& target); // Check for a an unused variable void LogUnused(const char* reason, const std::string& name) const; -- cgit v0.12 From 6c8dc7f1df6d3492d11ad994a35ee2f0b8a4e60b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:36 +0200 Subject: cmake: Simplify find-package mode library addition It does not need the cmMakefile version. --- Source/cmake.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 14124f8..dad8717 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -568,7 +568,7 @@ bool cmake::FindPackage(const std::vector& args) cmSystemTools::ExpandListArgument(libs, libList); for (std::vector::const_iterator libIt = libList.begin(); libIt != libList.end(); ++libIt) { - mf->AddLinkLibraryForTarget(targetName, *libIt, GENERAL_LibraryType); + tgt->AddLinkLibrary(*mf, *libIt, GENERAL_LibraryType); } std::string buildType = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); -- cgit v0.12 From 7edfcd0e834a4dc8d3da9cada6ad6b9b46dfb4dd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:36 +0200 Subject: cmMakefile: Inline method into caller The various uses of AddLinkLibraryForTarget are going away. This is the only remaining non-deprecated use. --- Source/cmTargetLinkLibrariesCommand.cxx | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index e714309..d1de7ef 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -338,7 +338,35 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, // Handle normal case first. if (this->CurrentProcessingState != ProcessingKeywordLinkInterface && this->CurrentProcessingState != ProcessingPlainLinkInterface) { - this->Makefile->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt); + + cmTarget* t = + this->Makefile->FindLocalNonAliasTarget(this->Target->GetName()); + if (!t) { + std::ostringstream e; + e << "Attempt to add link library \"" << lib << "\" to target \"" + << this->Target->GetName() + << "\" which is not built in this directory."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + } else { + + cmTarget* tgt = this->Makefile->GetGlobalGenerator()->FindTarget(lib); + + if (tgt && (tgt->GetType() != cmState::STATIC_LIBRARY) && + (tgt->GetType() != cmState::SHARED_LIBRARY) && + (tgt->GetType() != cmState::INTERFACE_LIBRARY) && + !tgt->IsExecutableWithExports()) { + std::ostringstream e; + e << "Target \"" << lib << "\" of type " + << cmState::GetTargetTypeName(tgt->GetType()) + << " may not be linked into another target. " + << "One may link only to STATIC or SHARED libraries, or " + << "to executables with the ENABLE_EXPORTS property set."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + } + + this->Target->AddLinkLibrary(*this->Makefile, lib, llt); + } + if (this->CurrentProcessingState == ProcessingLinkLibraries) { this->Target->AppendProperty( "INTERFACE_LINK_LIBRARIES", -- cgit v0.12 From 17ab8e33f005aab3e493ac4535f63b6f229aacab Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:36 +0200 Subject: cmMakefile: Inline method into only remaining caller --- Source/cmCPluginAPI.cxx | 35 ++++++++++++++++++++++++++++++++--- Source/cmMakefile.cxx | 29 ----------------------------- Source/cmMakefile.h | 2 -- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 2498ecb..56a469d 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -337,6 +337,35 @@ void CCONV cmAddCustomCommandToTarget(void* arg, const char* target, cctype, no_comment, no_working_dir); } +static void addLinkLibrary(cmMakefile* mf, std::string const& target, + std::string const& lib, cmTargetLinkLibraryType llt) +{ + cmTarget* t = mf->FindLocalNonAliasTarget(target); + if (!t) { + std::ostringstream e; + e << "Attempt to add link library \"" << lib << "\" to target \"" << target + << "\" which is not built in this directory."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return; + } + + cmTarget* tgt = mf->GetGlobalGenerator()->FindTarget(lib); + if (tgt && (tgt->GetType() != cmState::STATIC_LIBRARY) && + (tgt->GetType() != cmState::SHARED_LIBRARY) && + (tgt->GetType() != cmState::INTERFACE_LIBRARY) && + !tgt->IsExecutableWithExports()) { + std::ostringstream e; + e << "Target \"" << lib << "\" of type " + << cmState::GetTargetTypeName(tgt->GetType()) + << " may not be linked into another target. " + << "One may link only to STATIC or SHARED libraries, or " + << "to executables with the ENABLE_EXPORTS property set."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + } + + t->AddLinkLibrary(*mf, lib, llt); +} + void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt, const char* value, int libtype) { @@ -344,13 +373,13 @@ void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt, switch (libtype) { case CM_LIBRARY_GENERAL: - mf->AddLinkLibraryForTarget(tgt, value, GENERAL_LibraryType); + addLinkLibrary(mf, tgt, value, GENERAL_LibraryType); break; case CM_LIBRARY_DEBUG: - mf->AddLinkLibraryForTarget(tgt, value, DEBUG_LibraryType); + addLinkLibrary(mf, tgt, value, DEBUG_LibraryType); break; case CM_LIBRARY_OPTIMIZED: - mf->AddLinkLibraryForTarget(tgt, value, OPTIMIZED_LibraryType); + addLinkLibrary(mf, tgt, value, OPTIMIZED_LibraryType); break; } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index eda08c0..6e451b6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1216,35 +1216,6 @@ void cmMakefile::AddLinkLibrary(const std::string& lib, this->LinkLibraries.push_back(tmp); } -void cmMakefile::AddLinkLibraryForTarget(const std::string& target, - const std::string& lib, - cmTargetLinkLibraryType llt) -{ - cmTarget* t = this->FindLocalNonAliasTarget(target); - if (!t) { - std::ostringstream e; - e << "Attempt to add link library \"" << lib << "\" to target \"" << target - << "\" which is not built in this directory."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); - return; - } - - cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib); - if (tgt && (tgt->GetType() != cmState::STATIC_LIBRARY) && - (tgt->GetType() != cmState::SHARED_LIBRARY) && - (tgt->GetType() != cmState::INTERFACE_LIBRARY) && - !tgt->IsExecutableWithExports()) { - std::ostringstream e; - e << "Target \"" << lib << "\" of type " - << cmState::GetTargetTypeName(tgt->GetType()) - << " may not be linked into another target. " - << "One may link only to STATIC or SHARED libraries, or " - << "to executables with the ENABLE_EXPORTS property set."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); - } - t->AddLinkLibrary(*this, lib, llt); -} - void cmMakefile::InitializeFromParent(cmMakefile* parent) { this->SystemIncludeDirectories = parent->SystemIncludeDirectories; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 9f5f8ee..a16c6bb 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -200,8 +200,6 @@ public: * Add a link library to the build. */ void AddLinkLibrary(const std::string&, cmTargetLinkLibraryType type); - void AddLinkLibraryForTarget(const std::string& tgt, const std::string&, - cmTargetLinkLibraryType type); /** * Add a subdirectory to the build. -- cgit v0.12 From 4079ba20d9d9c8d15fd28d9440d56c907dda811c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:37 +0200 Subject: cmMakefile: Implement LinkLibraries as an internal property cmMakefile should not have logic particular to individual cmake commands. The link_libraries() command is generally obsolete in favor of target_link_libraries(). An alternative language for CMake probably would not offer the former. The quirks and historical behaviors of the current language should be separate from the core classes of CMake to allow replacing the language. --- Source/cmLinkLibrariesCommand.cxx | 7 ++-- Source/cmMakefile.cxx | 75 ++++++++++++++++++++++++--------------- Source/cmMakefile.h | 7 ---- 3 files changed, 50 insertions(+), 39 deletions(-) diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index 3fc7bd9..4202cf5 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -20,7 +20,7 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector const& args, "a library"); return false; } - this->Makefile->AddLinkLibrary(*i, DEBUG_LibraryType); + this->Makefile->AppendProperty("LINK_LIBRARIES", "debug"); } else if (*i == "optimized") { ++i; if (i == args.end()) { @@ -28,10 +28,9 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector const& args, "a library"); return false; } - this->Makefile->AddLinkLibrary(*i, OPTIMIZED_LibraryType); - } else { - this->Makefile->AddLinkLibrary(*i, GENERAL_LibraryType); + this->Makefile->AppendProperty("LINK_LIBRARIES", "optimized"); } + this->Makefile->AppendProperty("LINK_LIBRARIES", i->c_str()); } return true; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6e451b6..47d9b47 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1207,15 +1207,6 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) return true; } -void cmMakefile::AddLinkLibrary(const std::string& lib, - cmTargetLinkLibraryType llt) -{ - cmTarget::LibraryID tmp; - tmp.first = lib; - tmp.second = llt; - this->LinkLibraries.push_back(tmp); -} - void cmMakefile::InitializeFromParent(cmMakefile* parent) { this->SystemIncludeDirectories = parent->SystemIncludeDirectories; @@ -1247,7 +1238,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) } // link libraries - this->LinkLibraries = parent->LinkLibraries; + this->SetProperty("LINK_LIBRARIES", parent->GetProperty("LINK_LIBRARIES")); // link directories this->SetProperty("LINK_DIRECTORIES", @@ -1804,14 +1795,29 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target) } } - cmTarget::LinkLibraryVectorType::const_iterator i = - this->LinkLibraries.begin(); - for (; i != this->LinkLibraries.end(); ++i) { - // This is equivalent to the target_link_libraries plain signature. - target.AddLinkLibrary(*this, i->first, i->second); - target.AppendProperty( - "INTERFACE_LINK_LIBRARIES", - target.GetDebugGeneratorExpressions(i->first, i->second).c_str()); + if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) { + std::vector linkLibs; + cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs); + + for (std::vector::iterator j = linkLibs.begin(); + j != linkLibs.end(); ++j) { + std::string libraryName = *j; + cmTargetLinkLibraryType libType = GENERAL_LibraryType; + if (libraryName == "optimized") { + libType = OPTIMIZED_LibraryType; + ++j; + libraryName = *j; + } else if (libraryName == "debug") { + libType = DEBUG_LibraryType; + ++j; + libraryName = *j; + } + // This is equivalent to the target_link_libraries plain signature. + target.AddLinkLibrary(*this, libraryName, libType); + target.AppendProperty( + "INTERFACE_LINK_LIBRARIES", + target.GetDebugGeneratorExpressions(libraryName, libType).c_str()); + } } } @@ -2074,19 +2080,32 @@ void cmMakefile::ExpandVariablesCMP0019() } } } - for (cmTarget::LinkLibraryVectorType::iterator l = - this->LinkLibraries.begin(); - l != this->LinkLibraries.end(); ++l) { - if (mightExpandVariablesCMP0019(l->first.c_str())) { - std::string orig = l->first; - this->ExpandVariablesInString(l->first, true, true); - if (pol == cmPolicies::WARN && l->first != orig) { - /* clang-format off */ + + if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) { + std::vector linkLibs; + cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs); + + for (std::vector::iterator l = linkLibs.begin(); + l != linkLibs.end(); ++l) { + std::string libName = *l; + if (libName == "optimized") { + ++l; + libName = *l; + } else if (libName == "debug") { + ++l; + libName = *l; + } + if (mightExpandVariablesCMP0019(libName.c_str())) { + std::string orig = libName; + this->ExpandVariablesInString(libName, true, true); + if (pol == cmPolicies::WARN && libName != orig) { + /* clang-format off */ w << "Evaluated link library\n" << " " << orig << "\n" << "as\n" - << " " << l->first << "\n"; - /* clang-format on */ + << " " << libName << "\n"; + /* clang-format on */ + } } } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index a16c6bb..8fef38b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -197,11 +197,6 @@ public: const char* comment = CM_NULLPTR, bool uses_terminal = false); /** - * Add a link library to the build. - */ - void AddLinkLibrary(const std::string&, cmTargetLinkLibraryType type); - - /** * Add a subdirectory to the build. */ void AddSubDirectory(const std::string& fullSrcDir, @@ -808,8 +803,6 @@ protected: std::vector ListFiles; std::vector OutputFiles; - cmTarget::LinkLibraryVectorType LinkLibraries; - std::vector InstallGenerators; std::vector TestGenerators; -- cgit v0.12 From a1cfc4fe3deed4d642773d0ae63dd524c3f2eba1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Oct 2016 20:13:37 +0200 Subject: cmMakefile: Simplify programmer error to an assert --- Source/cmMakefile.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 47d9b47..6ab45bb 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1832,14 +1832,9 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname, const std::vector& srcs, bool excludeFromAll) { - // wrong type ? default to STATIC - if ((type != cmState::STATIC_LIBRARY) && (type != cmState::SHARED_LIBRARY) && - (type != cmState::MODULE_LIBRARY) && (type != cmState::OBJECT_LIBRARY) && - (type != cmState::INTERFACE_LIBRARY)) { - this->IssueMessage(cmake::INTERNAL_ERROR, - "cmMakefile::AddLibrary given invalid target type."); - type = cmState::STATIC_LIBRARY; - } + assert(type == cmState::STATIC_LIBRARY || type == cmState::SHARED_LIBRARY || + type == cmState::MODULE_LIBRARY || type == cmState::OBJECT_LIBRARY || + type == cmState::INTERFACE_LIBRARY); cmTarget* target = this->AddNewTarget(type, lname); // Clear its dependencies. Otherwise, dependencies might persist -- cgit v0.12