Use BeAPI for per-user package registry on Haiku
Applications on Haiku are discouraged from storing their data in $HOME. This teaches export(PACKAGE) and find_package() to use the BeAPI on Haiku to store the package registry instead of using ~/.cmake/packages. See issue #9603.
This commit is contained in:
parent
f73c769dd6
commit
6c59b924d2
|
@ -24,6 +24,10 @@
|
||||||
|
|
||||||
#include "cmExportBuildFileGenerator.h"
|
#include "cmExportBuildFileGenerator.h"
|
||||||
|
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
#include <StorageKit.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
cmExportCommand::cmExportCommand()
|
cmExportCommand::cmExportCommand()
|
||||||
:cmCommand()
|
:cmCommand()
|
||||||
,ArgumentGroup()
|
,ArgumentGroup()
|
||||||
|
@ -303,6 +307,16 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
|
||||||
const char* content,
|
const char* content,
|
||||||
const char* hash)
|
const char* hash)
|
||||||
{
|
{
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
BPath dir;
|
||||||
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &dir) != B_OK)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dir.Append("cmake/packages");
|
||||||
|
dir.Append(package.c_str());
|
||||||
|
std::string fname = dir.Path();
|
||||||
|
#else
|
||||||
const char* home = cmSystemTools::GetEnv("HOME");
|
const char* home = cmSystemTools::GetEnv("HOME");
|
||||||
if(!home)
|
if(!home)
|
||||||
{
|
{
|
||||||
|
@ -312,6 +326,7 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
|
||||||
cmSystemTools::ConvertToUnixSlashes(fname);
|
cmSystemTools::ConvertToUnixSlashes(fname);
|
||||||
fname += "/.cmake/packages/";
|
fname += "/.cmake/packages/";
|
||||||
fname += package;
|
fname += package;
|
||||||
|
#endif
|
||||||
cmSystemTools::MakeDirectory(fname.c_str());
|
cmSystemTools::MakeDirectory(fname.c_str());
|
||||||
fname += "/";
|
fname += "/";
|
||||||
fname += hash;
|
fname += hash;
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
#include "cmVariableWatch.h"
|
#include "cmVariableWatch.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
#include <StorageKit.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
|
void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
|
||||||
int access_type, void*, const char* newValue,
|
int access_type, void*, const char* newValue,
|
||||||
const cmMakefile*)
|
const cmMakefile*)
|
||||||
|
@ -1159,6 +1163,14 @@ void cmFindPackageCommand::AddPrefixesRegistry()
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
this->LoadPackageRegistryWin();
|
this->LoadPackageRegistryWin();
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
BPath dir;
|
||||||
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &dir) == B_OK)
|
||||||
|
{
|
||||||
|
dir.Append("cmake/packages");
|
||||||
|
dir.Append(this->Name.c_str());
|
||||||
|
this->LoadPackageRegistryDir(dir.Path());
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if(const char* home = cmSystemTools::GetEnv("HOME"))
|
if(const char* home = cmSystemTools::GetEnv("HOME"))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue