Skip to content

Commit

Permalink
RMG-Core: Fix GNUInstallDirs usage (#226)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
OPNA2608 authored Jan 28, 2024
1 parent ed9d9cb commit 685aa59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Source/RMG-Core/Config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 2 additions & 6 deletions Source/RMG-Core/Directories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 685aa59

Please sign in to comment.