file(GET_RUNTIME_DEPENDENCIES): Fix weak macOS libraries not detected

Starting with Clang 12, `otool -l` reports `LC_LOAD_WEAK_DYLIB` instead
of `LC_LOAD_DYLIB` for weakly linked libraries.  Update the
implementation of `file(GET_RUNTIME_DEPENDENCIES)` to recognize these.

Fixes: #21684
This commit is contained in:
Bianca van Schaik
2021-01-15 10:20:21 +01:00
committed by Brad King
parent f2d92b983b
commit 7e615a540e
3 changed files with 36 additions and 3 deletions
@@ -44,7 +44,7 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo(
std::string line;
static const cmsys::RegularExpression rpathRegex("^ *cmd LC_RPATH$");
static const cmsys::RegularExpression loadDylibRegex(
"^ *cmd LC_LOAD_DYLIB$");
"^ *cmd LC_LOAD(_WEAK)?_DYLIB$");
static const cmsys::RegularExpression pathRegex(
"^ *path (.*) \\(offset [0-9]+\\)$");
static const cmsys::RegularExpression nameRegex(