From: Szilard Pall Date: Thu, 29 Nov 2012 14:57:33 +0000 (+0100) Subject: fix cmake re-running failure introduced by ef1127f X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=7401379f7eb2c494476618abd411e7381fcc0aab;p=alexxy%2Fgromacs.git fix cmake re-running failure introduced by ef1127f The find_package(CUDA) macro needs to be called even after we've done the GPU detection/setup, otherwise functionality provided by this module will not be available and CUDA compilation helper macros will not be found. Change-Id: I6320f20fc3189f5be57b7344ca8049ee418bc3fb --- diff --git a/cmake/gmxManageGPU.cmake b/cmake/gmxManageGPU.cmake index 168fe2897e..5db51b31b1 100644 --- a/cmake/gmxManageGPU.cmake +++ b/cmake/gmxManageGPU.cmake @@ -23,8 +23,18 @@ if (GMX_GPU OR GMX_GPU_AUTO AND NOT GMX_GPU_DETECTION_DONE) gmx_detect_gpu() endif() +# We need to call find_package even when we've already done the detection/setup +if(GMX_GPU OR GMX_GPU_AUTO) + # We support CUDA >=v3.2 on *nix, but <= v4.1 doesn't work with MSVC + if(MSVC) + find_package(CUDA 4.1) + else() + find_package(CUDA 3.2) + endif() +endif() + # Depending on the current vale of GMX_GPU and GMX_GPU_AUTO: -# - OFF, FALSE: Will skip this detection. +# - OFF, FALSE: Will skip this detection/setup. # - OFF, TRUE : Will keep GMX_GPU=OFF if no CUDA is detected, but will assemble # a warning message which will be issued at the end of the # configuration if GPU(s) were found in the build system. @@ -32,13 +42,6 @@ endif() # if it is not available. # - ON , TRUE : Can't happen (GMX_GPU=ON can only be user-set at this point) if(GMX_GPU OR GMX_GPU_AUTO AND NOT GMX_GPU_DETECTION_DONE) - # We support CUDA >=v3.2 on *nix, but <= v4.1 doesn't work with MSVC - if(MSVC) - find_package(CUDA 4.1) - else() - find_package(CUDA 3.2) - endif() - if (EXISTS ${CUDA_TOOLKIT_ROOT_DIR}) set(CUDA_FOUND TRUE CACHE INTERNAL "Whether the CUDA toolkit was found" FORCE) else()