Merge topic 'cuda_architectures_disable' into release-3.18

877a92e968 CUDA: Add support for disabling CUDA_ARCHITECTURES

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4886
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index cd47aa6..bb516d3 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -146,7 +146,14 @@
       set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
     endif()
 
-    if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS "${_clang_version_std17}")
+    if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 6.0)
+      set(CMAKE_${lang}17_STANDARD__HAS_FULL_SUPPORT ON)
+    endif()
+
+    if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0)
+      set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20")
+      set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
+    elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS "${_clang_version_std17}")
       set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++2a")
       set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
     endif()
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index 599b1d2..4b88bea 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -85,7 +85,7 @@
       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) {
diff --git a/Tests/RunCMake/find_program/ExeNoRead-stdout.txt b/Tests/RunCMake/find_program/ExeNoRead-stdout.txt
index 35a83f2..f231178 100644
--- a/Tests/RunCMake/find_program/ExeNoRead-stdout.txt
+++ b/Tests/RunCMake/find_program/ExeNoRead-stdout.txt
@@ -1 +1 @@
--- ExeNoRead_EXECUTABLE='.*/Tests/RunCMake/find_program/ExeNoRead-build/ExeNoRead'
+-- ExeNoRead_EXECUTABLE='ExeNoRead_EXECUTABLE-NOTFOUND'
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 @@
 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()