From b753a6794b6b96acb2499a4a9e67cb8bc16afdc6 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 29 Dec 2003 14:55:43 -0500 Subject: [PATCH] BUG: use ./ infront of the current directory --- Source/cmLocalGenerator.cxx | 17 +++++++++++++++++ Source/cmLocalUnixMakefileGenerator.cxx | 12 +++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index df90deab5..32f09524f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -65,12 +65,15 @@ void cmLocalGenerator::ConfigureFinalPass() std::string cmLocalGenerator::ConvertToRelativeOutputPath(const char* p) { + // do not use relative paths for network build trees + // the network paths do not work const char* outputDirectory = m_Makefile->GetHomeOutputDirectory(); if ( outputDirectory && *outputDirectory && *(outputDirectory+1) && outputDirectory[0] == '/' && outputDirectory[1] == '/' ) { return cmSystemTools::ConvertToOutputPath(p); } + // The first time this is called, initialize all // the path ivars that are used. This can not // be moved to the constructor because all the paths are not set yet. @@ -103,6 +106,13 @@ std::string cmLocalGenerator::ConvertToRelativeOutputPath(const char* p) // Do the work of converting to a relative path std::string pathIn = p; + bool ispath = false; + if(pathIn.find('/') == pathIn.npos) + { + return pathIn; + } + + std::string ret = pathIn; if(m_CurrentOutputDirectory.size() <= ret.size()) { @@ -170,6 +180,13 @@ std::string cmLocalGenerator::ConvertToRelativeOutputPath(const char* p) { ret = relpath; } + if(ret.size() && ret[0] != '/' && ret[0] != '.') + { + if(ret.size() > 1 && ret[1] != ':') + { + ret = std::string("./") + ret; + } + } ret = cmSystemTools::ConvertToOutputPath(ret.c_str()); return ret; } diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index dbb132e85..e05ff42fd 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -1324,11 +1324,11 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout, target += cmSystemTools::GetExecutableExtension(); target = this->ConvertToRelativeOutputPath(target.c_str()); bool needsLocalTarget = false; - if(target.find('/') != target.npos) + if(target.find('/', 2) != target.npos) { needsLocalTarget = true; } - + std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") "; std::string depend = "$("; depend += this->CreateMakeVariable(name, "_SRC_OBJS") @@ -1922,7 +1922,13 @@ BuildInSubDirectoryWindows(std::ostream& fout, std::string currentDir = dir; cmSystemTools::ConvertToUnixSlashes(currentDir); std::string cdback = ".."; - for(unsigned int i =0; i < currentDir.size(); ++i) + unsigned int i = 0; + if(currentDir.size() > 2 && currentDir[0] == '.' && currentDir[1] == '/') + { + // start past ./ if it starts with ./ + i = 2; + } + for(; i < currentDir.size(); ++i) { if(currentDir[i] == '/') {