From 685aa597c7ee7ad7cfd4dd782f40d21863b75899 Mon Sep 17 00:00:00 2001 From: Cosima Neidahl Date: Sun, 28 Jan 2024 21:37:42 +0100 Subject: [PATCH] RMG-Core: Fix GNUInstallDirs usage (#226) One may not manually prepend `CMAKE_INSTALL_*DIR` variables with `CMAKE_INSTALL_PREFIX`, because `CMAKE_INSTALL_*DIR` variables may already be absolute paths - inside *or* outside of `CMAKE_INSTALL_PREFIX`. To get a guaranteed-absolute version of them, `CMAKE_INSTALL_FULL_*DIR` must be used. --- Source/RMG-Core/Config.hpp.in | 4 ++-- Source/RMG-Core/Directories.cpp | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Source/RMG-Core/Config.hpp.in b/Source/RMG-Core/Config.hpp.in index c1a35be6..a50ea7e9 100644 --- a/Source/RMG-Core/Config.hpp.in +++ b/Source/RMG-Core/Config.hpp.in @@ -14,8 +14,8 @@ #ifndef PORTABLE_INSTALL #define CORE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" -#define CORE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" -#define CORE_INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}" +#define CORE_INSTALL_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}" +#define CORE_INSTALL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}" #endif // PORTABLE_INSTALL #endif // CORE_CONFIG_HPP diff --git a/Source/RMG-Core/Directories.cpp b/Source/RMG-Core/Directories.cpp index 4b124e14..1c13833e 100644 --- a/Source/RMG-Core/Directories.cpp +++ b/Source/RMG-Core/Directories.cpp @@ -244,9 +244,7 @@ std::filesystem::path CoreGetLibraryDirectory(void) } else { - directory = CORE_INSTALL_PREFIX; - directory += "/"; - directory += CORE_INSTALL_LIBDIR; + directory = CORE_INSTALL_LIBDIR; directory += "/RMG"; } #endif // PORTABLE_INSTALL @@ -465,9 +463,7 @@ std::filesystem::path CoreGetSharedDataDirectory(void) } else { - directory = CORE_INSTALL_PREFIX; - directory += "/"; - directory += CORE_INSTALL_DATADIR; + directory = CORE_INSTALL_DATADIR; directory += "/RMG"; } #endif // PORTABLE_INSTALL