From 544ad6f9759de6acc109307caee2100478cba8ed Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 6 Feb 2018 17:17:28 +0100 Subject: build: Use GNUInstallDirs instead of hardcoded values This changes the build to use GNUInstallDirs instead of hardcoded values. Package maintainers can then override these defaults by passing the correct value to cmake on the command line. Signed-off-by: Sander Vrijders --- CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index c8f946bd..c5ea3bf1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,14 +22,14 @@ if (NOT CMAKE_BUILD_TYPE) endif() if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "/" CACHE STRING "Installation Prefix" FORCE) + set(CMAKE_INSTALL_PREFIX "/usr" CACHE STRING "Installation Prefix" FORCE) endif () if (APPLE) set(CMAKE_MACOSX_RPATH 1) endif() -if (CMAKE_INSTALL_PREFIX STREQUAL "/") +if (CMAKE_INSTALL_PREFIX STREQUAL "/usr") set(RPATH_PREFIX "") else () set(RPATH_PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -40,9 +40,9 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - "${RPATH_PREFIX}/usr/lib" isSystemDir) + "${RPATH_PREFIX}/lib" isSystemDir) IF ("${isSystemDir}" STREQUAL "-1") - set(CMAKE_INSTALL_RPATH "${RPATH_PREFIX}/usr/lib") + set(CMAKE_INSTALL_RPATH "${RPATH_PREFIX}/lib") ENDIF ("${isSystemDir}" STREQUAL "-1") message(STATUS "Package name is: ${PACKAGE_NAME}") @@ -101,17 +101,17 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ouroboros-irm.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/ouroboros-irm.pc" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ouroboros-dev.pc" - DESTINATION "usr/lib/pkgconfig") + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ouroboros-irm.pc" - DESTINATION "usr/lib/pkgconfig") + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") if (IS_DIRECTORY "/usr/lib/systemd") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/irmd.service.in" "${CMAKE_CURRENT_BINARY_DIR}/irmd.service" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/irmd.service" - DESTINATION "usr/lib/systemd/system") + DESTINATION "${CMAKE_INSTALL_LIBDIR}/systemd/system") endif () enable_testing() -- cgit v1.2.3