mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-01 13:29:08 -06:00
Use RUNPATH in installed library by default
When checking out from source code, the paths that were used to configure the project should be carried on to the installed binary, so the same libraries are used without much effort. By using RUNPATH instead of (just) RPATH, it can be overridden with LD_LIBRARY_PATH if the user so desires.
This commit is contained in:
parent
0bac3406dd
commit
ae53847e52
@ -1,8 +1,24 @@
|
||||
# - Default settings for the build
|
||||
|
||||
include (UseCompVer)
|
||||
include(TestCXXAcceptsFlag)
|
||||
|
||||
macro (opm_defaults opm)
|
||||
# if we are installing a development version (default when checking out of
|
||||
# VCS), then remember which directories were used when configuring. package
|
||||
# distribution should disable this option.
|
||||
option (USE_RUNPATH "Embed original dependency paths in installed library" ON)
|
||||
if (USE_RUNPATH)
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
check_cxx_accepts_flag ("-Wl,--enable-new-dtags" HAVE_RUNPATH)
|
||||
if (HAVE_RUNPATH)
|
||||
list (APPEND ${opm}_LINKER_FLAGS "-Wl,--enable-new-dtags")
|
||||
endif (HAVE_RUNPATH)
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||
# set this to avoid CMake stripping it off again
|
||||
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
endif (USE_RUNPATH)
|
||||
|
||||
# build release by default
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE "Release")
|
||||
|
13
cmake/Scripts/configure
vendored
13
cmake/Scripts/configure
vendored
@ -19,6 +19,7 @@ Optional Features:
|
||||
of the options shared and static may be built.
|
||||
--enable-debug build a non-optimized version of the library
|
||||
[default=no]
|
||||
--disable-runpath do not use RUNPATH in installed library [default=yes]
|
||||
--enable-lto use whole program optimization [default=no]
|
||||
--disable-tests do not compile and enable unit tests [default=yes]
|
||||
--disable-examples do not compile example programs [default=yes]
|
||||
@ -108,6 +109,8 @@ silent_rules=
|
||||
debug_loc=
|
||||
#use_lto=" -DWHOLE_PROG_OPTIM=OFF"
|
||||
use_lto=
|
||||
#use_runpath=" -DUSE_RUNPATH=OFF"
|
||||
use_runpath=
|
||||
#use_tests=" -DBUILD_TESTING=ON"
|
||||
use_tests=
|
||||
#use_samples=" -DBUILD_EXAMPLES=ON"
|
||||
@ -235,6 +238,10 @@ for OPT in "$@"; do
|
||||
pch_use=" -DPRECOMPILE_HEADERS:BOOL=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
runpath)
|
||||
use_runpath=" -DUSE_RUNPATH=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
silent-rules)
|
||||
silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=ON"
|
||||
pkgname=""
|
||||
@ -313,6 +320,10 @@ for OPT in "$@"; do
|
||||
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
|
||||
shared=""
|
||||
;;
|
||||
runpath)
|
||||
use_runpath=" -DUSE_RUNPATH=ON"
|
||||
shared=""
|
||||
;;
|
||||
lto)
|
||||
use_lto=" -DWHOLE_PROG_OPTIM=ON"
|
||||
shared=""
|
||||
@ -373,7 +384,7 @@ for a in "${VARS[@]}"; do
|
||||
done
|
||||
|
||||
# pass everything on to CMake
|
||||
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_tests}${use_samples} ${FEATURES}"
|
||||
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_runpath}${use_tests}${use_samples} ${FEATURES}"
|
||||
echo --- calling CMake ---
|
||||
echo ${CMDLINE}
|
||||
eval exec ${CMDLINE}
|
||||
|
Loading…
Reference in New Issue
Block a user