always mark as advanced leftover FindCUDA variables
[alexxy/gromacs.git] / CMakeLists.txt
index 7dd6f4540ad4ad95709be43f6be69b4dd911ec0e..b8aa8e05cba31ffdd8eb209df8bbf397e9e34ec7 100644 (file)
@@ -581,10 +581,11 @@ if(GMX_GPU)
     if(CMAKE_COMPILER_IS_GNUCC)
         set(GROMACS_LINKER_FLAGS "-Wl,--add-needed ${GROMACS_LINKER_FLAGS}")
     endif()
-
-    # annoyingly enough, FindCUDA leaves a few variables behind as non-advanced
-    mark_as_advanced(CUDA_BUILD_CUBIN CUDA_BUILD_EMULATION CUDA_SDK_ROOT_DIR CUDA_VERBOSE_BUILD)
 endif()
+# Annoyingly enough, FindCUDA leaves a few variables behind as non-advanced.
+# We need to mark these advanced outside the conditional, otherwise, if the user
+# tuns GMX_GPU=OFF after a failed cmake pass, these variables will be left behind.
+mark_as_advanced(CUDA_BUILD_CUBIN CUDA_BUILD_EMULATION CUDA_SDK_ROOT_DIR CUDA_VERBOSE_BUILD)
 
 if(APPLE)
    find_library(ACCELERATE_FRAMEWORK Accelerate)