Install .debug files in system location if writable
If the installation prefix is set to /usr, then it is assumed that the user has write access to the entire of that subtree, and that it would be advantageous to put the .debug files in the /usr/lib/debug directory. This is the usual case for package installations. On the other hand, if the prefix is NOT /usr, then it is probably a local installation; someone trying to install it to a more restricted area. In that case, the default is to follow the binary, so that GDB will still pick up the .debug file when loading the shared object. In any case can this default be overridden, should it turn out that the configuration script has guessed wrongly for your needs.
This commit is contained in:
@@ -247,12 +247,26 @@ install (
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
# only this directory seems to be searched for debug info
|
||||
# only /usr/lib/debug seems to be searched for debug info; if we have
|
||||
# write access to that directory (package installation), then default
|
||||
# to use it; otherwise put the debug files together with the library
|
||||
# (local installation). everything can be overridden by the option.
|
||||
if (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
||||
set (_sys_dbg_def ON)
|
||||
else (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
||||
set (_sys_dbg_def OFF)
|
||||
endif (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
||||
option (SYSTEM_DEBUG "Put .debug files in GDB debug file directory" ${_sys_dbg_def})
|
||||
set (DEBUG_FILE_DIRECTORY /usr/lib/debug CACHE LOCATION "GDB debug file directory")
|
||||
mark_as_advanced (DEBUG_FILE_DIRECTORY)
|
||||
if (SYSTEM_DEBUG)
|
||||
set (_dbg_prefix "${DEBUG_FILE_DIRECTORY}/")
|
||||
else (SYSTEM_DEBUG)
|
||||
set (_dbg_prefix "")
|
||||
endif (SYSTEM_DEBUG)
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/${opm-core_DEBUG}
|
||||
DESTINATION ${DEBUG_FILE_DIRECTORY}/${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
|
||||
DESTINATION ${_dbg_prefix}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/dune.module
|
||||
|
||||
16
configure
vendored
16
configure
vendored
@@ -17,6 +17,8 @@ Optional Features:
|
||||
--disable-debug build a release version of the library [default=no]
|
||||
--disable-pch do not use precompiled headers (if buggy compiler)
|
||||
--disable-silent-rules print every compilation statement as executed
|
||||
--enable-system-debug put .debug files in global GDB debug dir
|
||||
[default=yes if prefix=/usr, no otherwise]
|
||||
|
||||
Optional Packages:
|
||||
--with-dune-common=PATH use DUNE-common library from a specified location
|
||||
@@ -70,6 +72,8 @@ buildtype=Debug
|
||||
pch_use=
|
||||
#silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=OFF"
|
||||
silent_rules=
|
||||
#debug_loc=" -DSYSTEM_DEBUG=OFF"
|
||||
debug_loc=
|
||||
|
||||
# this variable will get feature options
|
||||
FEATURES=
|
||||
@@ -156,6 +160,10 @@ while getopts -- ":-:" optchar; do
|
||||
silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=ON"
|
||||
pkgname=""
|
||||
;;
|
||||
system-debug)
|
||||
silent_rules=" -DSYSTEM_DEBUG=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
agmg |\
|
||||
ert |\
|
||||
superlu)
|
||||
@@ -176,6 +184,11 @@ while getopts -- ":-:" optchar; do
|
||||
# what kind of library are we building; shared or static?
|
||||
kind=${OPTARG#enable-}
|
||||
case "${kind}" in
|
||||
system-debug)
|
||||
debug_loc=" -DSYSTEM_DEBUG=ON"
|
||||
# special flag; don't set shared/static
|
||||
shared=""
|
||||
;;
|
||||
shared)
|
||||
shared="ON"
|
||||
;;
|
||||
@@ -187,6 +200,7 @@ while getopts -- ":-:" optchar; do
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
test -n "${shared}" && \
|
||||
FEATURES="${FEATURES} -DBUILD_opm-core_SHARED:BOOL=${shared}"
|
||||
;;
|
||||
*)
|
||||
@@ -210,7 +224,7 @@ shift $((OPTIND-1))
|
||||
ENVVARS=${@/ACLOCAL_*=*/}
|
||||
|
||||
# pass everything on to CMake
|
||||
CMDLINE="env ${ENVVARS} cmake \"$(dirname "$0")\" \"-DCMAKE_INSTALL_PREFIX=$prefix\" -DCMAKE_BUILD_TYPE=${buildtype}${pch_use}${silent_rules} ${FEATURES}"
|
||||
CMDLINE="env ${ENVVARS} cmake \"$(dirname "$0")\" \"-DCMAKE_INSTALL_PREFIX=$prefix\" -DCMAKE_BUILD_TYPE=${buildtype}${pch_use}${silent_rules}${debug_loc} ${FEATURES}"
|
||||
echo --- calling CMake for opm-core ---
|
||||
echo ${CMDLINE}
|
||||
eval exec ${CMDLINE}
|
||||
|
||||
Reference in New Issue
Block a user