From 2dc73d239a42218fcf4de7b21f2898f0935b96b1 Mon Sep 17 00:00:00 2001 From: nia <29542929+alarixnia@users.noreply.github.com> Date: Sun, 26 Sep 2021 16:04:30 +0000 Subject: [PATCH] Use CMake's GNUInstallDirs for install directories on Unix (#11636) This makes the installation process honor system-specific directories (e.g. ${PREFIX}/man instead of ${PREFIX}/share/man on BSD). --- CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1995f34b8..e542d3509 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,15 +135,16 @@ elseif(UNIX) # Linux, BSD etc set(ICONDIR "unix/icons") set(LOCALEDIR "locale") else() - set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}") - set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin") - set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}") - set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man") + include(GNUInstallDirs) + set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}") + set(BINDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(DOCDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}") + set(MANDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_MANDIR}") set(EXAMPLE_CONF_DIR ${DOCDIR}) - set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications") - set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/metainfo") - set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons") - set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale") + set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/applications") + set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/metainfo") + set(ICONDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/icons") + set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALEDIR}") endif() endif()