Merge topic 'revert-find_program-exe-no-read'

cc02ced530 find_program: Revert "Find programs that are executable but not readable"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4871
This commit is contained in:
Brad King
2020-06-15 12:57:58 +00:00
committed by Kitware Robot
3 changed files with 11 additions and 5 deletions

View File

@@ -85,7 +85,7 @@ struct cmFindProgramHelper
this->TestNameExt = cmStrCat(name, ext);
this->TestPath =
cmSystemTools::CollapseFullPath(this->TestNameExt, path);
bool exists = cmSystemTools::FileIsExecutable(this->TestPath);
bool exists = cmSystemTools::FileExists(this->TestPath, true);
exists ? this->DebugSearches.FoundAt(this->TestPath)
: this->DebugSearches.FailedAt(this->TestPath);
if (exists) {

View File

@@ -1 +1 @@
-- ExeNoRead_EXECUTABLE='.*/Tests/RunCMake/find_program/ExeNoRead-build/ExeNoRead'
-- ExeNoRead_EXECUTABLE='ExeNoRead_EXECUTABLE-NOTFOUND'

View File

@@ -9,8 +9,14 @@ run_cmake(Required)
if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$")
run_cmake(WindowsCom)
run_cmake(WindowsExe)
endif()
else()
# test non readable file only if not root
execute_process(
COMMAND id -u $ENV{USER}
OUTPUT_VARIABLE uid
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(UNIX)
run_cmake(ExeNoRead)
if(NOT "${uid}" STREQUAL "0")
run_cmake(ExeNoRead)
endif()
endif()