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

Sam Spilsbury smspillaz at gmail.com
Fri Jun 6 10:11:11 EDT 2014


For IMPORTED libraries we treat those like INTERFACE libraries. The
actual target for an IMPORTED library is not generated. This would
have normally resulted in the passing of the path to the IMPORTED
library as a dependency

which works in some, but not all cases, because the path is not
guaranteed to be absolute. In particular, it fails on the Ninja
generator.

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.

Added ImportedExternalProjectLibrary, which builds a library in a sister
subdirectory to an executable as an external project, the alternate
sister subdirectory adding the library as an IMPORTED library
depending on the external project and linking to it.

Fixes #13574.
---
 Source/cmComputeLinkInformation.cxx                     |  4 ++--
 Tests/CMakeLists.txt                                    |  1 +
 Tests/ImportedExternalProjectLibrary/CMakeLists.txt     |  5 +++++
 .../ImportedExternalProjectLibraryDir/CMakeLists.txt    |  3 +++
 .../ImportedExternalProjectLibrary.c                    |  6 ++++++
 .../LibrarySubdir/CMakeLists.txt                        | 17 +++++++++++++++++
 .../ProjectWithImportedLibrary/CMakeLists.txt           |  4 ++++
 .../LibrarySubdir/ProjectWithImportedLibrary/library.c  |  4 ++++
 8 files changed, 42 insertions(+), 2 deletions(-)
 create mode 100644 Tests/ImportedExternalProjectLibrary/CMakeLists.txt
 create mode 100644
Tests/ImportedExternalProjectLibrary/ImportedExternalProjectLibraryDir/CMakeLists.txt
 create mode 100644
Tests/ImportedExternalProjectLibrary/ImportedExternalProjectLibraryDir/ImportedExternalProjectLibrary.c
 create mode 100644
Tests/ImportedExternalProjectLibrary/LibrarySubdir/CMakeLists.txt
 create mode 100644
Tests/ImportedExternalProjectLibrary/LibrarySubdir/ProjectWithImportedLibrary/CMakeLists.txt
 create mode 100644
Tests/ImportedExternalProjectLibrary/LibrarySubdir/ProjectWithImportedLibrary/library.c



-- 
Sam Spilsbury
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cmComputeLinkInformation-Don-t-add-build-dependencie.patch
Type: application/octet-stream
Size: 7039 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140606/9cb6a385/attachment-0001.obj>


More information about the cmake-developers mailing list