Keep FindCUDA quiet when it is not useful
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 5 Dec 2012 14:59:59 +0000 (15:59 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 5 Dec 2012 15:17:06 +0000 (16:17 +0100)
If detection has been done and GPUs were not detected, a user who
didn't give orders about using GPUs should not need to worry about
anything with CUDA in the name. Otherwise, messages like
"CUDA_TOOLKIT_ROOT_DIR not found or specified" are emitted
by FindCUDA as warnings, and require user interaction when
using ccmake.

Change-Id: If31603a4bdfd72ca5ed4f0313f708b3efe778a74

cmake/gmxManageGPU.cmake

index 1a0b12edec42b2d86df4b45209ade009df8c5777..2d0121555a1a26cba4dc94538b8398d4120dde87 100644 (file)
@@ -59,11 +59,16 @@ endif()
 
 # We need to call find_package even when we've already done the detection/setup
 if(GMX_GPU OR GMX_GPU_AUTO)
+    if(NOT GMX_GPU AND GMX_GPU_AUTO AND GMX_GPU_DETECTION_DONE)
+        # Stay quiet when detection has occured and found no GPU.
+        # Noise is acceptable when there is a GPU or the user required one.
+        set(FIND_CUDA_QUIETLY QUIET)
+    endif()
     # We support CUDA >=v3.2 on *nix, but <= v4.1 doesn't work with MSVC
     if(MSVC)
-        find_package(CUDA 4.1)
+        find_package(CUDA 4.1 ${FIND_CUDA_QUIETLY})
     else()
-        find_package(CUDA 3.2)
+        find_package(CUDA 3.2 ${FIND_CUDA_QUIETLY})
     endif()
 endif()