Skip to content

file(GET_RUNTIME_DEPENDENCIES): optimize on macOS

Calls to otool on macOS can be quite expensive, and due to repeated transitive libraries like those in Trilinos, CMake's GET_RUNTIME_DEPENDENCIES option makes numerous calls to resolve the same file's dependencies. This small addition memoizes the processed output from otool.

The following table demonstrates the 10x performance increase for a modern-cmake version of a subset of SCALE:

Version otool calls time time w/ virus check
Original 1367 18.2s 22.4s
Optimized 125 1.9s 2.0s

The resulting relocated installation works as expected.

I suspect the Linux and Windows version of the tool could use the same optimization, but I won't be able to easily test on those platforms.

Backport: release

Edited by Brad King

Merge request reports