summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_program/RunCMakeTest.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/find_program/RunCMakeTest.cmake')
-rw-r--r--Tests/RunCMake/find_program/RunCMakeTest.cmake12
1 files changed, 9 insertions, 3 deletions
diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake
index 95ffd84..2bb777b 100644
--- a/Tests/RunCMake/find_program/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake
@@ -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()