MACOSX_RPATH

From Get docs
Cmake/docs/3.21/prop tgt/macosx rpath


MACOSX_RPATH

Whether this target on macOS or iOS is located at runtime using rpaths.

When this property is set to TRUE, the directory portion of the install_name field of this shared library will be @rpath unless overridden by INSTALL_NAME_DIR. This indicates the shared library is to be found at runtime using runtime paths (rpaths).

This property is initialized by the value of the variable CMAKE_MACOSX_RPATH if it is set when a target is created.

Runtime paths will also be embedded in binaries using this target and can be controlled by the INSTALL_RPATH target property on the target linking to this target.

Policy CMP0042 was introduced to change the default value of MACOSX_RPATH to TRUE. This is because use of @rpath is a more flexible and powerful alternative to @executable_path and @loader_path.

© 2000–2021 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.
https://cmake.org/cmake/help/v3.21/prop_tgt/MACOSX_RPATH.html