diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-04-06 18:51:53 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-04-06 18:51:53 (GMT) |
commit | 2a7964e310d56a0e36e3c8581ca6b4904da03e41 (patch) | |
tree | 1575f75f1a8d6303a5cd065008e8abaa6eec506e | |
parent | 3355878eeb5e3e5e8a5a68ac879b31df6ca7f6fd (diff) | |
download | CMake-2a7964e310d56a0e36e3c8581ca6b4904da03e41.zip CMake-2a7964e310d56a0e36e3c8581ca6b4904da03e41.tar.gz CMake-2a7964e310d56a0e36e3c8581ca6b4904da03e41.tar.bz2 |
ENH: better error reporting, and add NOTFOUND into cache for library and file find
-rw-r--r-- | Source/cmFindIncludeCommand.cxx | 24 | ||||
-rw-r--r-- | Source/cmFindLibraryCommand.cxx | 24 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 4 |
3 files changed, 43 insertions, 9 deletions
diff --git a/Source/cmFindIncludeCommand.cxx b/Source/cmFindIncludeCommand.cxx index ec33f4d..645ed0d 100644 --- a/Source/cmFindIncludeCommand.cxx +++ b/Source/cmFindIncludeCommand.cxx @@ -28,9 +28,12 @@ bool cmFindIncludeCommand::Invoke(std::vector<std::string>& args) // already, if so use that value and don't look for the program const char* cacheValue = cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str()); - if(cacheValue) + if(cacheValue ) { - m_Makefile->AddDefinition(args[0].c_str(), cacheValue); + if(strcmp(cacheValue, "NOTFOUND") != 0) + { + m_Makefile->AddDefinition(args[0].c_str(), cacheValue); + } return true; } std::vector<std::string> path; @@ -45,8 +48,8 @@ bool cmFindIncludeCommand::Invoke(std::vector<std::string>& args) // add the standard path cmSystemTools::GetPath(path); - - for(unsigned int k=0; k < path.size(); k++) + unsigned int k; + for(k=0; k < path.size(); k++) { std::string tryPath = path[k]; tryPath += "/"; @@ -61,6 +64,19 @@ bool cmFindIncludeCommand::Invoke(std::vector<std::string>& args) return true; } } + cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(), + "NOTFOUND", + cmCacheManager::PATH); + std::string message = "Include not found: "; + message += args[1]; + message += "\n"; + message += "looked in "; + for(k=0; k < path.size(); k++) + { + message += path[k]; + message += "\n"; + } + this->SetError(message.c_str()); return false; } diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 16c3ed8..1504af6 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -29,8 +29,11 @@ bool cmFindLibraryCommand::Invoke(std::vector<std::string>& args) const char* cacheValue = cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str()); if(cacheValue) - { - m_Makefile->AddDefinition(args[0].c_str(), cacheValue); + { + if(strcmp(cacheValue, "NOTFOUND") != 0) + { + m_Makefile->AddDefinition(args[0].c_str(), cacheValue); + } return true; } std::vector<std::string> path; @@ -45,8 +48,8 @@ bool cmFindLibraryCommand::Invoke(std::vector<std::string>& args) // add the standard path cmSystemTools::GetPath(path); - - for(unsigned int k=0; k < path.size(); k++) + unsigned int k; + for(k=0; k < path.size(); k++) { std::string tryPath = path[k]; tryPath += "/"; @@ -60,6 +63,19 @@ bool cmFindLibraryCommand::Invoke(std::vector<std::string>& args) return true; } } + cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(), + "NOTFOUND", + cmCacheManager::PATH); + std::string message = "Library not found: "; + message += args[1]; + message += "\n"; + message += "looked in "; + for(k=0; k < path.size(); k++) + { + message += path[k]; + message += "\n"; + } + this->SetError(message.c_str()); return false; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 87cc709..f7fc85a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -190,7 +190,9 @@ bool cmMakefile::ReadListFile(const char* filename) { if(!usedCommand->Invoke(arguments)) { - cmSystemTools::Error(usedCommand->GetError()); + cmSystemTools::Error(usedCommand->GetName(), + ": Error : \n", + usedCommand->GetError()); } else { |