v0.14.0
WithSpack.cmake
Go to the documentation of this file.
1 option(WITHSPACK "Comopile with Spack" OFF)
2 if(WITH_SPACK)
3  # enable @rpath in the install name for any shared library being built
4  # note: it is planned that a future version of CMake will enable this by default
5  set(CMAKE_MACOSX_RPATH 1)
6 
7  # Always use full RPATH
8  # http://www.cmake.org/Wiki/CMake_RPATH_handling
9  # http://www.kitware.com/blog/home/post/510
10 
11  # use, i.e. don't skip the full RPATH for the build tree
12  set(CMAKE_SKIP_BUILD_RPATH FALSE)
13 
14  # when building, don't use the install RPATH already
15  # (but later on when installing)
16  set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
17 
18  # add the automatically determined parts of the RPATH
19  # which point to directories outside the build tree to the install RPATH
20  set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
21 
22  # the RPATH to be used when installing, but only if it's not a system directory
23  list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
24  if("${isSystemDir}" STREQUAL "-1")
25  set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
26  endif("${isSystemDir}" STREQUAL "-1")
27 endif(WITH_SPACK)
28