BUG: fix install problem on make and allow symlinks to cmake bin directory

This commit is contained in:
Bill Hoffman 2008-03-27 17:05:11 -04:00
parent 4f88f7e4de
commit 7dcfdf5005
3 changed files with 14 additions and 0 deletions

View File

@ -783,6 +783,7 @@ int cmake::AddCMakePaths()
{ {
// Find the cmake executable // Find the cmake executable
std::string cMakeSelf = cmSystemTools::GetExecutableDirectory(); std::string cMakeSelf = cmSystemTools::GetExecutableDirectory();
cMakeSelf = cmSystemTools::GetRealPath(cMakeSelf.c_str());
cMakeSelf += "/cmake"; cMakeSelf += "/cmake";
cMakeSelf += cmSystemTools::GetExecutableExtension(); cMakeSelf += cmSystemTools::GetExecutableExtension();
if(!cmSystemTools::FileExists(cMakeSelf.c_str())) if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
@ -858,6 +859,7 @@ int cmake::AddCMakePaths()
{ {
// next try exe/.. // next try exe/..
cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str()); cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str());
cMakeRoot = cmSystemTools::GetRealPath(cMakeRoot.c_str());
std::string::size_type slashPos = cMakeRoot.rfind("/"); std::string::size_type slashPos = cMakeRoot.rfind("/");
if(slashPos != std::string::npos) if(slashPos != std::string::npos)
{ {

View File

@ -2434,6 +2434,13 @@ kwsys_stl::string SystemTools
return ""; return "";
} }
kwsys_stl::string SystemTools::GetRealPath(const char* path)
{
kwsys_stl::string ret;
Realpath(path, ret);
return ret;
}
bool SystemTools::FileIsDirectory(const char* name) bool SystemTools::FileIsDirectory(const char* name)
{ {
// Remove any trailing slash from the name. // Remove any trailing slash from the name.

View File

@ -350,6 +350,11 @@ public:
static kwsys_stl::string CollapseFullPath(const char* in_relative, static kwsys_stl::string CollapseFullPath(const char* in_relative,
const char* in_base); const char* in_base);
/**
* Get the real path for a given path, removing all symlinks.
*/
static kwsys_stl::string GetRealPath(const char* path);
/** /**
* Split a path name into its root component and the rest of the * Split a path name into its root component and the rest of the
* path. The root component is one of the following: * path. The root component is one of the following: