summaryrefslogtreecommitdiffstats
path: root/Source/cmFindProgramCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2001-05-03 20:55:18 (GMT)
committerBrad King <brad.king@kitware.com>2001-05-03 20:55:18 (GMT)
commit5079efdc68c94d93a2b77e5b42dd229de2a77836 (patch)
tree93469d7eb36db26d6fbfa961c18663e0908243f1 /Source/cmFindProgramCommand.cxx
parent79f95167bd6b370a0f776010e554ddb9f1e21bb3 (diff)
downloadCMake-5079efdc68c94d93a2b77e5b42dd229de2a77836.zip
CMake-5079efdc68c94d93a2b77e5b42dd229de2a77836.tar.gz
CMake-5079efdc68c94d93a2b77e5b42dd229de2a77836.tar.bz2
ENH: Added cmSystemTools::FindProgram() and full-path detection utilities.
Diffstat (limited to 'Source/cmFindProgramCommand.cxx')
-rw-r--r--Source/cmFindProgramCommand.cxx32
1 files changed, 13 insertions, 19 deletions
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index a3d1854..aef1a74 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -76,27 +76,21 @@ bool cmFindProgramCommand::Invoke(std::vector<std::string>& args)
m_Makefile->ExpandVariablesInString(exp);
path.push_back(exp);
}
- cmSystemTools::GetPath(path);
-
- for(unsigned int k=0; k < path.size(); k++)
+
+ // Try to find the program.
+ std::string result = cmSystemTools::FindProgram(i->c_str(), path);
+
+ if(result != "")
{
- std::string tryPath = path[k];
- tryPath += "/";
- tryPath += *i;
-#ifdef _WIN32
- tryPath += ".exe";
-#endif
- if(cmSystemTools::FileExists(tryPath.c_str()))
- {
- // Save the value in the cache
- cmCacheManager::GetInstance()->AddCacheEntry(define,
- tryPath.c_str(),
- "Path to a program.",
- cmCacheManager::FILEPATH);
- m_Makefile->AddDefinition(define, tryPath.c_str());
- return true;
- }
+ // Save the value in the cache
+ cmCacheManager::GetInstance()->AddCacheEntry(define,
+ result.c_str(),
+ "Path to a program.",
+ cmCacheManager::FILEPATH);
+ m_Makefile->AddDefinition(define, result.c_str());
+ return true;
}
+
return false;
}