summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDA.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-01-30 13:18:11 (GMT)
committerBrad King <brad.king@kitware.com>2018-01-30 13:18:11 (GMT)
commit9f74aaeb7d6649241c4a478410e87d092c462960 (patch)
treea9a346f1b8ecf3ae9a8019800891fd251c82ef75 /Modules/FindCUDA.cmake
parentc6312835d5813fadf7dc818878d6c824bfece44b (diff)
downloadCMake-9f74aaeb7d6649241c4a478410e87d092c462960.zip
CMake-9f74aaeb7d6649241c4a478410e87d092c462960.tar.gz
CMake-9f74aaeb7d6649241c4a478410e87d092c462960.tar.bz2
FindCUDA: Fix regression in per-config flags
Changes in commit 48f7e2d300 (Unhardcode the CMAKE_CONFIGURATION_TYPES values, 2017-11-27) accidentally left `CUDA_configuration_types` undefined, but this is used in a few places to handle per-config flags. Restore it. Fixes: #17671
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r--Modules/FindCUDA.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 0decbb5..0a31ac2 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -585,6 +585,18 @@ mark_as_advanced(
CUDA_SEPARABLE_COMPILATION
)
+# Single config generators like Makefiles or Ninja don't usually have
+# CMAKE_CONFIGURATION_TYPES defined (but note that it can be defined if set by
+# projects or developers). Even CMAKE_BUILD_TYPE might not be defined for
+# single config generators (and should not be defined for multi-config
+# generators). To ensure we get a complete superset of all possible
+# configurations, we combine CMAKE_CONFIGURATION_TYPES, CMAKE_BUILD_TYPE and
+# all of the standard configurations, then weed out duplicates with
+# list(REMOVE_DUPLICATES). Looping over the unique set then ensures we have
+# each configuration-specific set of nvcc flags defined and marked as advanced.
+set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo)
+list(REMOVE_DUPLICATES CUDA_configuration_types)
+
###############################################################################
###############################################################################
# Locate CUDA, Set Build Type, etc.