diff options
author | Vladimir Menshakov <vladimir.menshakov@gmail.com> | 2020-04-04 16:16:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-04-09 12:08:50 (GMT) |
commit | 86e6349ef7356866704ab2a5aa439fd4d201cdd5 (patch) | |
tree | 2f6c88b8041508d8b6dc01d7caee764de18a387a /Source/cmFindProgramCommand.cxx | |
parent | df543e37f1c60919c98bb11494458e5dedd72c11 (diff) | |
download | CMake-86e6349ef7356866704ab2a5aa439fd4d201cdd5.zip CMake-86e6349ef7356866704ab2a5aa439fd4d201cdd5.tar.gz CMake-86e6349ef7356866704ab2a5aa439fd4d201cdd5.tar.bz2 |
find_program: Find programs that are executable but not readable
`find_program` internally uses `cmSystemTools::FileExists`
which calls `access(R_OK)` instead of `access(X_OK)`.
Use `cmSystemTools::IsFileExecutable` instead to fix this
issue. An example of such a program is `sudo`.
Fixes: #10468
Diffstat (limited to 'Source/cmFindProgramCommand.cxx')
-rw-r--r-- | Source/cmFindProgramCommand.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 4b88bea..599b1d2 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -85,7 +85,7 @@ struct cmFindProgramHelper this->TestNameExt = cmStrCat(name, ext); this->TestPath = cmSystemTools::CollapseFullPath(this->TestNameExt, path); - bool exists = cmSystemTools::FileExists(this->TestPath, true); + bool exists = cmSystemTools::FileIsExecutable(this->TestPath); exists ? this->DebugSearches.FoundAt(this->TestPath) : this->DebugSearches.FailedAt(this->TestPath); if (exists) { |