mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 06:40:48 -06:00
ENH: add no_system_path option to FindProgram so that the PATH is ignored
This commit is contained in:
@@ -1428,7 +1428,8 @@ std::string cmSystemTools::FindFile(const char* name,
|
||||
* found. Otherwise, the empty string is returned.
|
||||
*/
|
||||
std::string cmSystemTools::FindProgram(const char* name,
|
||||
const std::vector<std::string>& userPaths)
|
||||
const std::vector<std::string>& userPaths,
|
||||
bool no_system_path)
|
||||
{
|
||||
// See if the executable exists as written.
|
||||
if(cmSystemTools::FileExists(name) &&
|
||||
@@ -1446,7 +1447,10 @@ std::string cmSystemTools::FindProgram(const char* name,
|
||||
|
||||
// Add the system search path to our path.
|
||||
std::vector<std::string> path = userPaths;
|
||||
cmSystemTools::GetPath(path);
|
||||
if (!no_system_path)
|
||||
{
|
||||
cmSystemTools::GetPath(path);
|
||||
}
|
||||
|
||||
for(std::vector<std::string>::const_iterator p = path.begin();
|
||||
p != path.end(); ++p)
|
||||
|
||||
@@ -220,7 +220,8 @@ public:
|
||||
|
||||
///! Find an executable in the system PATH, with optional extra paths.
|
||||
static std::string FindProgram(const char* name,
|
||||
const std::vector<std::string>& path= std::vector<std::string>());
|
||||
const std::vector<std::string>& path = std::vector<std::string>(),
|
||||
bool no_system_path = false);
|
||||
|
||||
///! Find a library in the system PATH, with optional extra paths.
|
||||
static std::string FindLibrary(const char* name,
|
||||
|
||||
Reference in New Issue
Block a user