Installing CMake package config files for MacOS frameworks

The logic generating the code to compute PACKAGE_PREFIX_DIR assumes that there are no symbolic links involved. I don’t know if anyone has actually used CMakePackageConfigHelpers for a package configuration file inside a framework before.

The presence of symbolic links inside the framework may be problematic. MyPackage_DIR can be set by users to be either

  • <prefix>/MyPackage.framework/Resources/CMake, or
  • <prefix>/MyPackage.framework/Versions/Current/Resources/CMake, or
  • <prefix>/MyPackage.framework/Versions/B/Resources/CMake.

In all of those cases we need to be able to recover the <prefix>, but the number of components that needs to be removed is not the same for all cases.