From 7dcfdf5005adf43a13c48a917066d8bc115d0d96 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 27 Mar 2008 17:05:11 -0400 Subject: BUG: fix install problem on make and allow symlinks to cmake bin directory --- Source/cmake.cxx | 2 ++ Source/kwsys/SystemTools.cxx | 7 +++++++ Source/kwsys/SystemTools.hxx.in | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 3b99a82..02e1770 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -783,6 +783,7 @@ int cmake::AddCMakePaths() { // Find the cmake executable std::string cMakeSelf = cmSystemTools::GetExecutableDirectory(); + cMakeSelf = cmSystemTools::GetRealPath(cMakeSelf.c_str()); cMakeSelf += "/cmake"; cMakeSelf += cmSystemTools::GetExecutableExtension(); if(!cmSystemTools::FileExists(cMakeSelf.c_str())) @@ -858,6 +859,7 @@ int cmake::AddCMakePaths() { // next try exe/.. cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str()); + cMakeRoot = cmSystemTools::GetRealPath(cMakeRoot.c_str()); std::string::size_type slashPos = cMakeRoot.rfind("/"); if(slashPos != std::string::npos) { diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index f6047a2..4815ffd 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2434,6 +2434,13 @@ kwsys_stl::string SystemTools return ""; } +kwsys_stl::string SystemTools::GetRealPath(const char* path) +{ + kwsys_stl::string ret; + Realpath(path, ret); + return ret; +} + bool SystemTools::FileIsDirectory(const char* name) { // Remove any trailing slash from the name. diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index d7f11ca..29f451c 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -350,6 +350,11 @@ public: static kwsys_stl::string CollapseFullPath(const char* in_relative, 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 * path. The root component is one of the following: -- cgit v0.12