title: Use CMAKE_MACOSX_RPATH to link a library outside build tree
body: <p>This issue is MacOS X specific. I would like to link a library <code>lib_xxx</code> that sits outside my build tree at some arbitrary location. It will be at the same location in all systems. By default CMake would add the dependency as follows </p>
  
  <pre><code>@executable_path/libwupienginemac.dylib
  </code></pre>
  
  <p>I would like to know how to change <code>@executable_path</code> to either:</p>
  
  <ol>
  <li><p>Absolute path to the library. I see, for example the following in <code>otool</code> output</p>
  
  <pre><code>/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
  </code></pre></li>
  <li><p><code>@rpath</code> I could then manage the location of <code>lib_xxx</code> using <code>RPATH</code>. I prefer this option. </p></li>
  </ol>
  
  <p>From the documentation and forums it looks like <code>CMAKE_MACOSX_RPATH</code> should solve the issue and implement option (2). Yet the <code>CMakeLists.txt</code> below still results in <code>@executable_path/libwupienginemac.dylib</code> dependency. </p>
  
  <pre><code>cmake_minimum_required(VERSION 3.1)
  
  project(xxx_test)
  
  set(CMAKE_MACOSX_RPATH 1)
  find_library(LIB_XXX lib_xxx
      PATHS "/path/to/lib_xxx/lib"
      )
  if (NOT LIB_XXX)
      message(FATAL_ERROR ""LIB XXX not found")
   endif()
  
  add_executable(xxx_test xxx_test.cpp)
  target_link_libraries(xxx_test
      ${LIB_XXX}
  )
  # Try running the executable at once
  add_custom_target(wibut_test_run ALL
      COMMAND xxx_test
      DEPENDS xxx_test
      )
  </code></pre>