Răsfoiți Sursa

FindCUDA: Fix CMP0007 warning in run_nvcc.cmake

Set `CMP0007` to `NEW` for the entire script.  The script comes with
CMake and is aware of the policy's behavior, so set the policy to ensure
that its warnings do not show up during the build phase.

Fixes: #16579
Umar Arshad 8 ani în urmă
părinte
comite
8b09c20c3a
1 a modificat fișierele cu 4 adăugiri și 5 ștergeri
  1. 4 5
      Modules/FindCUDA/run_nvcc.cmake

+ 4 - 5
Modules/FindCUDA/run_nvcc.cmake

@@ -50,6 +50,8 @@
 # generated_cubin_file:STRING=<> File to generate.  This argument must be passed
 #                                                   in if build_cubin is true.
 
+cmake_policy(PUSH)
+cmake_policy(SET CMP0007 NEW)
 if(NOT generated_file)
   message(FATAL_ERROR "You must specify generated_file on the command line")
 endif()
@@ -179,13 +181,8 @@ cuda_execute_process(
 set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
 set(CUDA_VERSION @CUDA_VERSION@)
 if(CUDA_VERSION VERSION_LESS "3.0")
-  cmake_policy(PUSH)
-  # CMake policy 0007 NEW states that empty list elements are not
-  # ignored.  I'm just setting it to avoid the warning that's printed.
-  cmake_policy(SET CMP0007 NEW)
   # Note that this will remove all occurances of -G.
   list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G")
-  cmake_policy(POP)
 endif()
 
 # nvcc doesn't define __CUDACC__ for some reason when generating dependency files.  This
@@ -304,3 +301,5 @@ if( build_cubin )
     )
 
 endif()
+
+cmake_policy(POP)