Skip to content

Commit

Permalink
Use CMAKE_INSTALL_PREFIX rather than hardcoding /usr on UNIX
Browse files Browse the repository at this point in the history
  • Loading branch information
chewi committed Dec 15, 2024
1 parent b92e172 commit 53a55de
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Sources/Jazz2/ContentResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ namespace Jazz2
# elif defined(NCINE_OVERRIDE_CONTENT_PATH)
_contentPath = NCINE_OVERRIDE_CONTENT_PATH;
# else
_contentPath = "/usr/share/" NCINE_LINUX_PACKAGE "/Content/";
_contentPath = INSTALL_PREFIX "/share/" NCINE_LINUX_PACKAGE "/Content/";
# endif
# if defined(NCINE_PACKAGED_CONTENT_PATH)
// If Content is packaged with binaries, always use standard XDG paths for everything else
Expand All @@ -235,7 +235,7 @@ namespace Jazz2
} else {
_cachePath = "Cache/"_s;
}
_sourcePath = "/usr/share/" NCINE_LINUX_PACKAGE "/Source/";
_sourcePath = INSTALL_PREFIX "/share/" NCINE_LINUX_PACKAGE "/Source/";
if (!fs::DirectoryExists(_sourcePath)) {
_sourcePath = fs::CombinePath(fs::GetDirectoryName(_cachePath), "Source/"_s);
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace Death { namespace Environment {
{
FILE* fp = ::fopen("/etc/os-release", "r");
if (fp == nullptr) {
fp = ::fopen("/usr/lib/os-release", "r");
fp = ::fopen(INSTALL_PREFIX "/lib/os-release", "r");
if (fp == nullptr) {
return {};
}
Expand Down
1 change: 1 addition & 0 deletions cmake/ncine_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ function(ncine_apply_compiler_options target)
target_compile_features(${target} PUBLIC cxx_std_17)
set_target_properties(${target} PROPERTIES CXX_EXTENSIONS OFF)
target_compile_definitions(${target} PUBLIC "CMAKE_BUILD")
target_compile_definitions(${target} PRIVATE "INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\"")

if(DEATH_DEBUG)
target_compile_definitions(${target} PUBLIC "DEATH_DEBUG")
Expand Down

0 comments on commit 53a55de

Please sign in to comment.