Skip to content

Commit e9968cd

Browse files
committed
Let CMake handle CUDA requirements
CMake should already know which versions of CUDA are required depending on which standard is being used. The current setup forbids compiling with C++17 for the host code and C++14 for CUDA. This will require modifications in TMVA to work, but relaxing this restriction will at least allow compilation of ROOT with CUDA and C++17 when it's supported by Nvidia.
1 parent 5e0a9cc commit e9968cd

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

cmake/modules/SearchInstalledSoftware.cmake

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,14 +1371,12 @@ endif()
13711371
#---Check for CUDA-----------------------------------------------------------------------
13721372

13731373
if(cuda OR tmva-gpu)
1374-
if(CMAKE_CXX_STANDARD EQUAL 11)
1375-
find_package(CUDA 7.5)
1376-
elseif(CMAKE_CXX_STANDARD EQUAL 14)
1377-
message(STATUS "Detected request for c++14, requiring minimum version CUDA 9.0 (default 7.5)")
1378-
find_package(CUDA 9.0)
1379-
else()
1380-
message(FATAL_ERROR "CUDA not supported with C++${CMAKE_CXX_STANDARD}")
1374+
find_package(CUDA REQUIRED)
1375+
1376+
if(NOT DEFINED CMAKE_CUDA_STANDARD)
1377+
set(CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})
13811378
endif()
1379+
13821380
enable_language(CUDA)
13831381
endif()
13841382

0 commit comments

Comments
 (0)