[cmake-developers] [PATCH 1/2] cmComputeLinkInformation: Don't add build dependencies on IMPORTED libraries

Brad King brad.king at kitware.com
Fri Jun 6 10:55:14 EDT 2014


On 06/06/2014 10:11 AM, Sam Spilsbury wrote:
> The solution is just not to add dependencies on such libraries, as any
> dependencies of the IMPORTED target itself will be added as
> dependencies of targets depending on the IMPORTED target.

There are no build rules for imported targets so they have no
dependencies anyway.  The patch in question:

       // Pass the full path to the target file.
       std::string lib = tgt->GetFullPath(config, implib, true);
-      if(!this->LinkDependsNoShared ||
-         tgt->GetType() != cmTarget::SHARED_LIBRARY)
+      if((!this->LinkDependsNoShared ||
+          tgt->GetType() != cmTarget::SHARED_LIBRARY) && !tgt->IsImported())
         {
         this->Depends.push_back(lib);
         }

touches code used to generate dependencies on a link rule.
If link rules do not depend on imported libraries then they
will not re-link when those libraries change on disk.  This
is incorrect.

> Fixes #13574.

All generators except Ninja are able to deal with this correctly.
The place to fix it must be in the Ninja generator.

Thanks,
-Brad




More information about the cmake-developers mailing list