# macOS: linking application with ParaView libraries and NOT depending on DYLD\_LIBRARY\_PATH

**URL:** https://discourse.paraview.org/t/macos-linking-application-with-paraview-libraries-and-not-depending-on-dyld-library-path/6413
**Category:** Development
**Created:** [February 8, 2021, 5:07am UTC](https://discourse.paraview.org/t/macos-linking-application-with-paraview-libraries-and-not-depending-on-dyld-library-path/6413 "2021-02-08T05:07:54Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![DrRoot](https://discourse.paraview.org/user_avatar/discourse.paraview.org/drroot/32/5867_2.png) [@DrRoot](https://discourse.paraview.org/u/DrRoot)
#### Post date: [February 8, 2021, 5:31pm UTC](https://discourse.paraview.org/t/macos-linking-application-with-paraview-libraries-and-not-depending-on-dyld-library-path/6413/5 "2021-02-08T17:31:24Z")

</div>

I work on a simulation framework and with the following settings is the main CMakeList.txt file, I got the build I want, relocatable using @rpath for macOS and $ORIGIN on Linux and optionally with absolute path names for a fixed install. This are the cmake settings that work, for me:

```
# When building, don't use the install RPATH already (but later on when installing)
set(CMAKE_SKIP_BUILD_RPATH FALSE) # don't skip the full RPATH for the build tree
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # use always the build RPATH for the build tree
set(CMAKE_MACOSX_RPATH TRUE) # use RPATH for MacOSX
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # point to directories outside the build tree to the install RPATH

# Check whether to add RPATH to the installation (the build tree always has the RPATH enabled)
if(rpath)
  set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) # install LIBDIR
  set(CMAKE_SKIP_INSTALL_RPATH FALSE) # don't skip the full RPATH for the install tree
elseif(APPLE)
  set(CMAKE_INSTALL_NAME_DIR "@rpath")
  set(CMAKE_INSTALL_RPATH "@loader_path/../lib") # self relative LIBDIR
  set(CMAKE_SKIP_INSTALL_RPATH FALSE) # don't skip the full RPATH for the install tree
else()
  set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) # skip the full RPATH for the install tree
  set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") # self relative LIBDIR
  set(CMAKE_SKIP_INSTALL_RPATH FALSE) # don't skip the full RPATH for the install tree
endif()

```

with -Drpath=ON to get explicitly the fixed absolute path install (not default).

Using the super build, will these cmake setting propagate down the chain?

---

_[View the full topic](https://discourse.paraview.org/t/macos-linking-application-with-paraview-libraries-and-not-depending-on-dyld-library-path/6413)._
