mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06: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:
@@ -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