mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 21:59:54 -06:00
Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream * upstream-KWSys: KWSys 2020-04-07 (caff9c3b)
This commit is contained in:
@@ -2807,7 +2807,7 @@ std::string SystemTools::FindProgram(const std::string& name,
|
|||||||
for (std::string const& ext : extensions) {
|
for (std::string const& ext : extensions) {
|
||||||
tryPath = name;
|
tryPath = name;
|
||||||
tryPath += ext;
|
tryPath += ext;
|
||||||
if (SystemTools::FileExists(tryPath, true)) {
|
if (SystemTools::FileIsExecutable(tryPath)) {
|
||||||
return SystemTools::CollapseFullPath(tryPath);
|
return SystemTools::CollapseFullPath(tryPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2815,7 +2815,7 @@ std::string SystemTools::FindProgram(const std::string& name,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// now try just the name
|
// now try just the name
|
||||||
if (SystemTools::FileExists(name, true)) {
|
if (SystemTools::FileIsExecutable(name)) {
|
||||||
return SystemTools::CollapseFullPath(name);
|
return SystemTools::CollapseFullPath(name);
|
||||||
}
|
}
|
||||||
// now construct the path
|
// now construct the path
|
||||||
@@ -2845,7 +2845,7 @@ std::string SystemTools::FindProgram(const std::string& name,
|
|||||||
tryPath = p;
|
tryPath = p;
|
||||||
tryPath += name;
|
tryPath += name;
|
||||||
tryPath += ext;
|
tryPath += ext;
|
||||||
if (SystemTools::FileExists(tryPath, true)) {
|
if (SystemTools::FileIsExecutable(tryPath)) {
|
||||||
return SystemTools::CollapseFullPath(tryPath);
|
return SystemTools::CollapseFullPath(tryPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2853,7 +2853,7 @@ std::string SystemTools::FindProgram(const std::string& name,
|
|||||||
// now try it without them
|
// now try it without them
|
||||||
tryPath = p;
|
tryPath = p;
|
||||||
tryPath += name;
|
tryPath += name;
|
||||||
if (SystemTools::FileExists(tryPath, true)) {
|
if (SystemTools::FileIsExecutable(tryPath)) {
|
||||||
return SystemTools::CollapseFullPath(tryPath);
|
return SystemTools::CollapseFullPath(tryPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3008,6 +3008,11 @@ bool SystemTools::FileIsDirectory(const std::string& inName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SystemTools::FileIsExecutable(const std::string& name)
|
||||||
|
{
|
||||||
|
return !FileIsDirectory(name) && TestFileAccess(name, TEST_FILE_EXECUTE);
|
||||||
|
}
|
||||||
|
|
||||||
bool SystemTools::FileIsSymlink(const std::string& name)
|
bool SystemTools::FileIsSymlink(const std::string& name)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@@ -3172,7 +3177,7 @@ bool SystemTools::FindProgramPath(const char* argv0, std::string& pathOut,
|
|||||||
failures.push_back(self);
|
failures.push_back(self);
|
||||||
SystemTools::ConvertToUnixSlashes(self);
|
SystemTools::ConvertToUnixSlashes(self);
|
||||||
self = SystemTools::FindProgram(self);
|
self = SystemTools::FindProgram(self);
|
||||||
if (!SystemTools::FileExists(self)) {
|
if (!SystemTools::FileIsExecutable(self)) {
|
||||||
if (buildDir) {
|
if (buildDir) {
|
||||||
std::string intdir = ".";
|
std::string intdir = ".";
|
||||||
#ifdef CMAKE_INTDIR
|
#ifdef CMAKE_INTDIR
|
||||||
@@ -3187,14 +3192,14 @@ bool SystemTools::FindProgramPath(const char* argv0, std::string& pathOut,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (installPrefix) {
|
if (installPrefix) {
|
||||||
if (!SystemTools::FileExists(self)) {
|
if (!SystemTools::FileIsExecutable(self)) {
|
||||||
failures.push_back(self);
|
failures.push_back(self);
|
||||||
self = installPrefix;
|
self = installPrefix;
|
||||||
self += "/bin/";
|
self += "/bin/";
|
||||||
self += exeName;
|
self += exeName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!SystemTools::FileExists(self)) {
|
if (!SystemTools::FileIsExecutable(self)) {
|
||||||
failures.push_back(self);
|
failures.push_back(self);
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << "Can not find the command line program ";
|
msg << "Can not find the command line program ";
|
||||||
|
|||||||
@@ -676,6 +676,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
static bool FileIsDirectory(const std::string& name);
|
static bool FileIsDirectory(const std::string& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the file is an executable
|
||||||
|
*/
|
||||||
|
static bool FileIsExecutable(const std::string& name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the file is a symlink
|
* Return true if the file is a symlink
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user