Commit d362da52 authored by Ghislain MARY's avatar Ghislain MARY

Fix debian package generation + always use GNU install dir to install libraries.

parent 28575013
......@@ -54,27 +54,9 @@ include(GNUInstallDirs)
add_subdirectory(build)
# Note for Gnu/Unix systems:
# The library install director should ideally be set, according to GNUInstallDirs,
# to ${CMAKE_INSTALL_LIBDIR} for libraries, which are OS specific.
# HOWEVER autotools does not care about these specificities and ALWAYS sets them
# to $(exec_prefix)/lib (cf https://www.gnu.org/prep/standards/html_node/Directory-Variables.html)
# When using a custom prefix, we should follow the autotools guidelines because any project using pkg-config to find our library
# will expect it to be in $(exec_prefix)/lib, and NOT in $(exec_prefix)/${CMAKE_INSTALL_LIBDIR} since
# pkg-config does not let us introduce an -rpath settings to tell it where our library is located.
# Conversely, when NOT using a custom prefix, we can properly install our library in ${CMAKE_INSTALL_LIBDIR}
# because systems add extra locations for pkg-config to search in.
if("${CPACK_GENERATOR}" STREQUAL "RPM" OR "${CPACK_GENERATOR}" STREQUAL "DEB")
# do nothing, we are using the "officials" install prefix
else()
# force them to the default autotools values
message("Setting CMAKE_INSTALL_LIBDIR to ${CMAKE_INSTALL_PREFIX}/lib for non-package build")
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX)
if(NOT CPACK_GENERATOR AND NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_LIBDIR})
message(STATUS "Setting install rpath to ${CMAKE_INSTALL_RPATH}")
endif()
......
......@@ -75,7 +75,10 @@ if("${CPACK_GENERATOR}" STREQUAL "RPM" OR "${CPACK_GENERATOR}" STREQUAL "DEB")
endif()
if("${CPACK_GENERATOR}" STREQUAL "DEB")
set(CPACK_DEBIAN_PACKAGE_DEBUG ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CPackEnv.cmake")
file(WRITE "${CPACK_PROJECT_CONFIG_FILE}" "set(ENV{LD_LIBRARY_PATH} \"./${CMAKE_INSTALL_FULL_LIBDIR}\")")
set(SHLIBS_FILE "${CMAKE_CURRENT_BINARY_DIR}/shlibs")
file(WRITE "${SHLIBS_FILE}" "libbctoolbox ${BCTOOLBOX_SO_VERSION} ${CPACK_PACKAGE_NAME}\n")
file(APPEND "${SHLIBS_FILE}" "libbctoolbox-tester ${BCTOOLBOXTESTER_SO_VERSION} ${CPACK_PACKAGE_NAME}\n")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment