Running libheif's examples in macOS Sonoma 14.2.1 (have not checked earlier macOS versions) gives an error:
```
% /usr/local/bin/heif-info /System/Library/Desktop\ Pictures/Sonoma.heic
dyld[92961]: Library not loaded: @rpath/libheif.1.dylib
  Referenced from: <B7A8B87B-46A4-3205-A732-A4F618AFB2F7> /usr/local/bin/heif-info
  Reason: no LC_RPATH's found
zsh: abort      /usr/local/bin/heif-info /System/Library/Desktop\ Pictures/Sonoma.heic
```
Inserting the following at the top of `examples/CMakeLists.txt` fixes the problem
```
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
```
which translates to `/usr/local/lib`. (Perhaps the line above should be wrapped between `if (APPLE)` and `endif ()` lines?)

_(I admittedly know almost nothing about CMake, so it's not clear if this is the best, most efficient, or most CMake-ish way of fixing this bug. BTW, setting the `DYLD_LIBRARY_PATH` environment variable to `/usr/local/lib` also fixes the problem, but CMake already knows where it is installing the library, so there's no reason to **not** set rpath appropriately.)_ 
libheif's examples do not run in macOS Sonoma
This is a GitHub Issue
repo:libheif
owner:strukturag
Title : libheif's examples do not run in macOS Sonoma
Issue date:

--- start body ---
Running libheif's examples in macOS Sonoma 14.2.1 (have not checked earlier macOS versions) gives an error:
```
% /usr/local/bin/heif-info /System/Library/Desktop\ Pictures/Sonoma.heic
dyld[92961]: Library not loaded: @rpath/libheif.1.dylib
  Referenced from: <B7A8B87B-46A4-3205-A732-A4F618AFB2F7> /usr/local/bin/heif-info
  Reason: no LC_RPATH's found
zsh: abort      /usr/local/bin/heif-info /System/Library/Desktop\ Pictures/Sonoma.heic
```
Inserting the following at the top of `examples/CMakeLists.txt` fixes the problem
```
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
```
which translates to `/usr/local/lib`. (Perhaps the line above should be wrapped between `if (APPLE)` and `endif ()` lines?)

_(I admittedly know almost nothing about CMake, so it's not clear if this is the best, most efficient, or most CMake-ish way of fixing this bug. BTW, setting the `DYLD_LIBRARY_PATH` environment variable to `/usr/local/lib` also fixes the problem, but CMake already knows where it is installing the library, so there's no reason to **not** set rpath appropriately.)_ 
--- end body ---
