title: dyld not loading Ogre library
body: <p>I am trying to setup an environment to develop an Ogre3D application. I have manually compiled Ogre into folder <code>/opt/Ogre3D/ogre-1.11.5/build</code> and created a CMake project in CLion with this content:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.13)
  project(sample)
  
  set(CMAKE_CXX_STANDARD 14)
  set(OGRE_DIR /opt/Ogre3D/ogre-1.11.5/build/sdk/cmake)
  
  # specify which version and components you need
  find_package(OGRE 1.11 REQUIRED COMPONENTS Bites RTShaderSystem)
  
  # copy resource.cfg next to our binaries where OGRE looks for it
  file(COPY ${OGRE_CONFIG_DIR}/resources.cfg DESTINATION ${CMAKE_BINARY_DIR})
  
  add_executable(sample main.cpp)
  target_link_libraries(sample ${OGRE_LIBRARIES})
  
  </code></pre>
  
  <p>when I try to run it, compilation is OK but then it can't execute it:</p>
  
  <pre class="lang-sh prettyprint-override"><code>/Users/diego/CLionProjects/ogre/sample/cmake-build-debug/sample
  dyld: Library not loaded: @executable_path/../Frameworks/OgreBites.framework/Versions/1.11.5/OgreBites
    Referenced from: /Users/diego/CLionProjects/ogre/sample/cmake-build-debug/sample
    Reason: image not found
  
  Process finished with exit code 6
  </code></pre>
  
  <p>I have looked at <code>otool -l /opt/Ogre3D/ogre-1.11.5/build/lib/macosx/OgreBites.framework/Versions/1.11.5/OgreBites</code> and there is a command <code>LC_ID_DYLIB</code> with the name <code>@executable_path/../Frameworks/OgreBites.framework/Versions/1.11.5/OgreBites</code>, which matches the path given in the runtime error. However I don't know which step to take now as I have few experience with native library resolution on macOS.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Executing the command <code>install_name_tool</code> makes the linker find the library, but then it fails with the next one. I suppose/hope there is an option in CMake to pass it to the compiler so the binary files created during Ogre's compilation do not use the <code>@execute_path</code> directive?</p>