summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-27 20:25:09 (GMT)
committerBrad King <brad.king@kitware.com>2015-03-27 20:25:09 (GMT)
commitac14cbf01710c08e9bf31670cf40d88512b55752 (patch)
treed6df138d63017c30c18b9b244d79d5f926bff120 /Source
parent817d31db9797bfc1c6ff7e60e420532362b14463 (diff)
downloadCMake-ac14cbf01710c08e9bf31670cf40d88512b55752.zip
CMake-ac14cbf01710c08e9bf31670cf40d88512b55752.tar.gz
CMake-ac14cbf01710c08e9bf31670cf40d88512b55752.tar.bz2
Allow add_dependencies() on INTERFACE libraries (#15414)
Revert commit v3.0.0-rc1~175^2~20 (add_dependencies: Disallow use with INTERFACE_LIBRARY, 2013-12-25). Teach our dependency analysis to transitively follow INTERFACE target utility dependencies as was done or IMPORTED targets in commit v2.8.6~127^2~1 (Allow add_dependencies() on imported targets, 2010-11-19). Extend the InterfaceLibrary test with a case to cover header generation for a header-only INTERFACE library via a custom target.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmAddDependenciesCommand.cxx9
-rw-r--r--Source/cmComputeTargetDepends.cxx6
2 files changed, 4 insertions, 11 deletions
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index b560452..3a74946 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -33,15 +33,6 @@ bool cmAddDependenciesCommand
}
if(cmTarget* target = this->Makefile->FindTargetToUse(target_name))
{
- if (target->GetType() == cmTarget::INTERFACE_LIBRARY)
- {
- std::ostringstream e;
- e << "Cannot add target-level dependencies to INTERFACE library "
- "target \"" << target_name << "\".\n";
- this->SetError(e.str());
- return false;
- }
-
std::vector<std::string>::const_iterator s = args.begin();
++s; // skip over target_name
for (; s != args.end(); ++s)
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index cf2b88e..bbffd5d 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -418,9 +418,11 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
cmTarget const* dependee,
bool linking)
{
- if(dependee->IsImported())
+ if(dependee->IsImported() ||
+ dependee->GetType() == cmTarget::INTERFACE_LIBRARY)
{
- // Skip imported targets but follow their utility dependencies.
+ // Skip IMPORTED and INTERFACE targets but follow their utility
+ // dependencies.
std::set<cmLinkItem> const& utils = dependee->GetUtilityItems();
for(std::set<cmLinkItem>::const_iterator i = utils.begin();
i != utils.end(); ++i)