mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-06 04:03:27 +03:00
target_link_libraries: Allow linking to UNKNOWN IMPORTED GLOBAL libs
This combination was accidentally rejected. Allow it and add a test. Fixes: #17245
This commit is contained in:
1 parent
4f96641ba2
commit
a47a853376
3 files changed
+6
No files matched your search
@@ -366,6 +366,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
|
||||
|
||||
if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) &&
|
||||
(tgt->GetType() != cmStateEnums::SHARED_LIBRARY) &&
|
||||
(tgt->GetType() != cmStateEnums::UNKNOWN_LIBRARY) &&
|
||||
(tgt->GetType() != cmStateEnums::INTERFACE_LIBRARY) &&
|
||||
!tgt->IsExecutableWithExports()) {
|
||||
std::ostringstream e;
|
||||
|
||||
@@ -10,3 +10,4 @@ run_cmake(SubDirTarget)
|
||||
run_cmake(SharedDepNotTarget)
|
||||
run_cmake(StaticPrivateDepNotExported)
|
||||
run_cmake(StaticPrivateDepNotTarget)
|
||||
run_cmake(UNKNOWN-IMPORTED-GLOBAL)
|
||||
@@ -0,0 +1,4 @@
|
||||
enable_language(C)
|
||||
add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL)
|
||||
add_library(mylib empty.c)
|
||||
target_link_libraries(mylib UnknownImportedGlobal)
|
||||
Reference in new issue
Block a user