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
0001-cmComputeLinkInformation-Don-t-add-build-dependencie.patch
Description: Binary data
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers