diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d4a3f68ad3..d0fc68fe72 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1629,7 +1629,9 @@ void cmLocalGenerator { // Compute the proper name to use to link this library. cmTarget* tgt = this->GlobalGenerator->FindTarget(0, lib.c_str()); - if(tgt) + if(tgt && (tgt->GetType() == cmTarget::STATIC_LIBRARY || + tgt->GetType() == cmTarget::SHARED_LIBRARY || + tgt->GetType() == cmTarget::MODULE_LIBRARY)) { // This is a CMake target. Ask the target for its real name. // Pass the full path to the target file but purposely leave