From ed50410ae7903c8ed4b772e55fb797e651790f32 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 28 Nov 2001 07:15:04 -0500 Subject: bug: fix same path comparison when short paths are used --- Source/cmNMakeMakefileGenerator.cxx | 13 ++++++++++++- Source/cmNMakeMakefileGenerator.h | 4 +++- Source/cmUnixMakefileGenerator.cxx | 12 +++++++++--- Source/cmUnixMakefileGenerator.h | 2 ++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx index 1e5a2f7..ab43d2e 100644 --- a/Source/cmNMakeMakefileGenerator.cxx +++ b/Source/cmNMakeMakefileGenerator.cxx @@ -549,7 +549,18 @@ void cmNMakeMakefileGenerator::OutputIncludeMakefile(std::ostream& fout, fout << "!include " << file << "\n"; } - +bool cmNMakeMakefileGenerator::SamePath(const char* path1, const char* path2) +{ + // first check to see if they are the same anyway + if (strcmp(path1, path2) == 0) + { + return true; + } + // next short path and lower case both of them for the compare + return + cmSystemTools::LowerCase(ShortPath(path1)) == + cmSystemTools::LowerCase(ShortPath(path2)); +} void cmNMakeMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout, const char* path, diff --git a/Source/cmNMakeMakefileGenerator.h b/Source/cmNMakeMakefileGenerator.h index 424aaef..e71abe9 100644 --- a/Source/cmNMakeMakefileGenerator.h +++ b/Source/cmNMakeMakefileGenerator.h @@ -103,7 +103,9 @@ protected: virtual void OutputBuildLibraryInDir(std::ostream& fout, const char* path, const char* library, - const char* fullpath); + const char* fullpath); + ///! return true if the two paths are the same (checks short paths) + virtual bool SamePath(const char* path1, const char* path2); private: bool m_QuoteNextCommand; // if this is true, OutputMakeRule // will not quote the next commands diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 4a588ee..e59b8b4 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -762,8 +762,8 @@ void cmUnixMakefileGenerator::OutputDependLibs(std::ostream& fout) const char* cacheValue = m_Makefile->GetDefinition(lib->c_str()); // if cache and not the current directory add a rule, to // jump into the directory and build for the first time - if(cacheValue - && (strcmp(m_Makefile->GetCurrentOutputDirectory(), cacheValue) != 0)) + if(cacheValue && + (!this->SamePath(m_Makefile->GetCurrentOutputDirectory(), cacheValue))) { std::string library = m_LibraryPrefix; library += *lib; @@ -811,6 +811,12 @@ void cmUnixMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout, << ":\n\tcd " << cmSystemTools::EscapeSpaces(path) << "; $(MAKE) " << fullpath << "\n\n"; } + +bool cmUnixMakefileGenerator::SamePath(const char* path1, const char* path2) +{ + return strcmp(path1, path2) == 0; +} + void cmUnixMakefileGenerator::OutputLibDepend(std::ostream& fout, const char* name) { @@ -820,7 +826,7 @@ void cmUnixMakefileGenerator::OutputLibDepend(std::ostream& fout, // if there is a cache value, then this is a library that cmake // knows how to build, so we can depend on it std::string libpath; - if (strcmp(m_Makefile->GetCurrentOutputDirectory(), cacheValue) != 0) + if (!this->SamePath(m_Makefile->GetCurrentOutputDirectory(), cacheValue)) { // if the library is not in the current directory, then get the full // path to it diff --git a/Source/cmUnixMakefileGenerator.h b/Source/cmUnixMakefileGenerator.h index 5209cf1..6018721c 100644 --- a/Source/cmUnixMakefileGenerator.h +++ b/Source/cmUnixMakefileGenerator.h @@ -155,6 +155,8 @@ protected: const char* path, const char* library, const char* fullpath); + ///! return true if the two paths are the same + virtual bool SamePath(const char* path1, const char* path2); virtual std::string GetOutputExtension(const char* sourceExtension); virtual void OutputIncludeMakefile(std::ostream&, const char* file); void SetObjectFileExtension(const char* e) { m_ObjectFileExtension = e;} -- cgit v0.12