diff options
author | James Bigler <jbigler@nvidia.com> | 2022-06-14 17:35:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-06-14 19:48:30 (GMT) |
commit | a7758394afc2717bb31a47826e62c1ba86a63c41 (patch) | |
tree | 24cc3234887494553bcfc5f924741f1dd65dd79f /Modules/FindCUDA.cmake | |
parent | ca8a5b05de811d6a95cfa7a33a2985f2b193967f (diff) | |
download | CMake-a7758394afc2717bb31a47826e62c1ba86a63c41.zip CMake-a7758394afc2717bb31a47826e62c1ba86a63c41.tar.gz CMake-a7758394afc2717bb31a47826e62c1ba86a63c41.tar.bz2 |
FindCUDA: Fix varaible reset with CUDA_TOOLKIT_TARGET_DIR
CUDA_TOOLKIT_TARGET_DIR doesn't always exist in the cache or defined by the user
previous to using FindCUDA. In this case it will always reset the variables
making it impossible to manually change or set them. This can be fixed by
checking to see if the variable is defined before checking against the
previously used version stored in CUDA_TOOLKIT_TARGET_DIR_INTERNAL.
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r-- | Modules/FindCUDA.cmake | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index af5f798..470111f 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -799,7 +799,9 @@ if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}") unset(CUDA_VERSION CACHE) endif() -if(NOT "${CUDA_TOOLKIT_TARGET_DIR}" STREQUAL "${CUDA_TOOLKIT_TARGET_DIR_INTERNAL}") +# If CUDA_TOOLKIT_TARGET_DIR exists, check if it has changed. +if(DEFINED CUDA_TOOLKIT_TARGET_DIR + AND NOT "${CUDA_TOOLKIT_TARGET_DIR}" STREQUAL "${CUDA_TOOLKIT_TARGET_DIR_INTERNAL}") cuda_unset_include_and_libraries() endif() |