summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCompileFeatures.cmake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-11-01 12:12:05 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2019-12-10 22:56:48 (GMT)
commit2467a2b3184595a87e93db510408fc14ddbaf3b9 (patch)
tree37e35f4a3c821634cc18c6cd8df8acf2391d4f5c /Modules/CMakeDetermineCompileFeatures.cmake
parentf62c674202045f877eaed9da0f9cbe2046452b40 (diff)
downloadCMake-2467a2b3184595a87e93db510408fc14ddbaf3b9.zip
CMake-2467a2b3184595a87e93db510408fc14ddbaf3b9.tar.gz
CMake-2467a2b3184595a87e93db510408fc14ddbaf3b9.tar.bz2
CUDA: Add cuda meta-features (e.g. ``cuda_std_11``) support
Diffstat (limited to 'Modules/CMakeDetermineCompileFeatures.cmake')
-rw-r--r--Modules/CMakeDetermineCompileFeatures.cmake51
1 files changed, 51 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake
index 6adebae..b50e5f1 100644
--- a/Modules/CMakeDetermineCompileFeatures.cmake
+++ b/Modules/CMakeDetermineCompileFeatures.cmake
@@ -91,6 +91,57 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES} PARENT_SCOPE)
message(CHECK_PASS "done")
+
+ elseif(lang STREQUAL CUDA AND COMMAND cmake_record_cuda_compile_features)
+ message(CHECK_START "Detecting ${lang} compile features")
+
+ set(CMAKE_CUDA03_COMPILE_FEATURES)
+ set(CMAKE_CUDA11_COMPILE_FEATURES)
+ set(CMAKE_CUDA14_COMPILE_FEATURES)
+ set(CMAKE_CUDA17_COMPILE_FEATURES)
+ set(CMAKE_CUDA20_COMPILE_FEATURES)
+
+ include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
+
+ cmake_record_cuda_compile_features()
+
+ if(NOT _result EQUAL 0)
+ message(CHECK_FAIL "failed")
+ return()
+ endif()
+
+ if (CMAKE_CUDA17_COMPILE_FEATURES AND CMAKE_CUDA20_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES})
+ endif()
+ if (CMAKE_CUDA14_COMPILE_FEATURES AND CMAKE_CUDA17_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CUDA17_COMPILE_FEATURES ${CMAKE_CUDA14_COMPILE_FEATURES})
+ endif()
+ if (CMAKE_CUDA11_COMPILE_FEATURES AND CMAKE_CUDA14_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CUDA14_COMPILE_FEATURES ${CMAKE_CUDA11_COMPILE_FEATURES})
+ endif()
+ if (CMAKE_CUDA03_COMPILE_FEATURES AND CMAKE_CUDA11_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CUDA11_COMPILE_FEATURES ${CMAKE_CUDA03_COMPILE_FEATURES})
+ endif()
+
+ if(NOT CMAKE_CUDA_COMPILE_FEATURES)
+ set(CMAKE_CUDA_COMPILE_FEATURES
+ ${CMAKE_CUDA03_COMPILE_FEATURES}
+ ${CMAKE_CUDA11_COMPILE_FEATURES}
+ ${CMAKE_CUDA14_COMPILE_FEATURES}
+ ${CMAKE_CUDA17_COMPILE_FEATURES}
+ ${CMAKE_CUDA20_COMPILE_FEATURES}
+ )
+ endif()
+
+ set(CMAKE_CUDA_COMPILE_FEATURES ${CMAKE_CUDA_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CUDA03_COMPILE_FEATURES ${CMAKE_CUDA03_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CUDA11_COMPILE_FEATURES ${CMAKE_CUDA11_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CUDA14_COMPILE_FEATURES ${CMAKE_CUDA14_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CUDA17_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES} PARENT_SCOPE)
+
+ message(CHECK_PASS "done")
+
endif()
endfunction()