From: Matthias Maier Date: Wed, 16 Aug 2017 14:13:55 +0000 (+0200) Subject: CMake: Disable CUDA for incompatible C++ standards X-Git-Tag: v9.0.0-rc1~1225^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f140a0aa3fa457da9ea8d887540ec1988f04d0bd;p=dealii.git CMake: Disable CUDA for incompatible C++ standards --- diff --git a/cmake/configure/configure_1_cuda.cmake b/cmake/configure/configure_1_cuda.cmake index 1c825ce2bd..ca8f42a163 100644 --- a/cmake/configure/configure_1_cuda.cmake +++ b/cmake/configure/configure_1_cuda.cmake @@ -45,6 +45,29 @@ MACRO(FEATURE_CUDA_FIND_EXTERNAL var) ) ENDIF() + # + # CUDA 8.0 requires C++11 support, CUDA 9.0 requires C++14 support. + # Make sure that deal.II is configured appropriately + # + MACRO(_cuda_ensure_feature_off _version _feature) + IF(${CUDA_VERSION_MAJOR} EQUAL ${_version}) + IF(${_feature}) + SET(${var} FALSE) + MESSAGE(STATUS "CUDA ${_version} requires ${_feature} to be set to off.") + SET(CUDA_ADDITIONAL_ERROR_STRING + ${CUDA_ADDITIONAL_ERROR_STRING} + "CUDA ${_version} is not compatible with the C++ standard\n" + "enabled by ${_feature}.\n" + "Please disable ${_feature}, e.g. by reconfiguring with\n" + " cmake -D${_feature}=OFF ." + ) + ENDIF() + ENDIF() + ENDMACRO() + _cuda_ensure_feature_off(8 DEAL_II_WITH_CXX14) + _cuda_ensure_feature_off(9 DEAL_II_WITH_CXX17) + + IF("${DEAL_II_CUDA_FLAGS_SAVED}" MATCHES "-arch[ ]*sm_([0-9]*)") SET(CUDA_COMPUTE_CAPABILITY "${CMAKE_MATCH_1}") ELSEIF("${DEAL_II_CUDA_FLAGS_SAVED}" MATCHES "-arch=sm_([0-9]*)")