diff options
author | Ken Martin <ken.martin@kitware.com> | 2001-02-26 22:14:33 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2001-02-26 22:14:33 (GMT) |
commit | 7cde8fd0f47143090b81dff813270f6894004af3 (patch) | |
tree | 5ac44e5d4c6f505fd0f32d7d2a7dd48174e18db7 /Source/cmFindProgramCommand.cxx | |
parent | 3acd5951ba5c6e978a6da486825e8ad61320f4eb (diff) | |
download | CMake-7cde8fd0f47143090b81dff813270f6894004af3.zip CMake-7cde8fd0f47143090b81dff813270f6894004af3.tar.gz CMake-7cde8fd0f47143090b81dff813270f6894004af3.tar.bz2 |
fixed bug and modified functionality
Diffstat (limited to 'Source/cmFindProgramCommand.cxx')
-rw-r--r-- | Source/cmFindProgramCommand.cxx | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 66d3f17..3e6e353 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -40,28 +40,35 @@ bool cmFindProgramCommand::Invoke(std::vector<std::string>& args) m_Makefile->AddDefinition(define, cacheValue); return true; } + // if it is not in the cache, then search the system path + // add any user specified paths std::vector<std::string> path; + for (unsigned int j = 2; j < args.size(); j++) + { + // expand variables + std::string exp = args[j]; + m_Makefile->ExpandVariablesInString(exp); + path.push_back(exp); + } cmSystemTools::GetPath(path); - for(; i != args.end(); ++i) + + for(unsigned int k=0; k < path.size(); k++) { - for(unsigned int k=0; k < path.size(); k++) - { - std::string tryPath = path[k]; - tryPath += "/"; - tryPath += *i; + std::string tryPath = path[k]; + tryPath += "/"; + tryPath += *i; #ifdef _WIN32 - tryPath += ".exe"; + tryPath += ".exe"; #endif - if(cmSystemTools::FileExists(tryPath.c_str())) - { - // Save the value in the cache - cmCacheManager::GetInstance()->AddCacheEntry(define, - tryPath.c_str(), - cmCacheManager::FILEPATH); - m_Makefile->AddDefinition(define, tryPath.c_str()); - return true; - } + if(cmSystemTools::FileExists(tryPath.c_str())) + { + // Save the value in the cache + cmCacheManager::GetInstance()->AddCacheEntry(define, + tryPath.c_str(), + cmCacheManager::FILEPATH); + m_Makefile->AddDefinition(define, tryPath.c_str()); + return true; } } return false; |