| 1 |
# Set directory used to save cmake config files |
| 2 |
# required to use fclib (e.g. to call find_package(fclib) ) |
| 3 |
set(ConfigPackageLocation lib/cmake/fclib-${PACKAGE_VERSION}) |
| 4 |
|
| 5 |
# Provides install directory variables as defined by the GNU Coding Standards. |
| 6 |
include(GNUInstallDirs) # It defines CMAKE_INSTALL_LIBDIR |
| 7 |
# RPATH stuff |
| 8 |
# Warning: RPATH settings must be defined before install(...) settings. |
| 9 |
# Source : https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling |
| 10 |
|
| 11 |
if(FORCE_SKIP_RPATH) # Build with no RPATH. Do we really need this option?? |
| 12 |
set(CMAKE_SKIP_BUILD_RPATH TRUE) |
| 13 |
else() |
| 14 |
set(CMAKE_SKIP_BUILD_RPATH FALSE) |
| 15 |
endif() |
| 16 |
|
| 17 |
# when building, don't use the install RPATH already |
| 18 |
# (but later on when installing) |
| 19 |
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) |
| 20 |
|
| 21 |
# when building a binary package, it makes no sense to add this rpath |
| 22 |
if(NOT FORCE_SKIP_RPATH) |
| 23 |
# the RPATH to be used when installing |
| 24 |
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") |
| 25 |
endif(NOT FORCE_SKIP_RPATH) |
| 26 |
|
| 27 |
# don't add the automatically determined parts of the RPATH |
| 28 |
# which point to directories outside the build tree to the install RPATH |
| 29 |
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
| 30 |
|
| 31 |
# the RPATH to be used when installing, but only if it's not a system directory |
| 32 |
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) |
| 33 |
if("${isSystemDir}" STREQUAL "-1") |
| 34 |
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") |
| 35 |
endif() |
| 36 |
|