diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e87e62..62fa538 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,17 +82,21 @@ FetchContent_MakeAvailable(repo-common repo-core repo-backend) # if(${TRITON_ENABLE_GPU}) find_package(CUDAToolkit REQUIRED) - message(STATUS "Using CUDA ${CUDA_VERSION}") + message(STATUS "Using CUDA ${CUDAToolkit_VERSION}") if (WIN32) set(CUDA_NVCC_FLAGS -std=c++17) else () set(CUDA_NVCC_FLAGS -std=c++11) endif () - if(CUDA_VERSION VERSION_GREATER "10.1" OR CUDA_VERSION VERSION_EQUAL "10.1") + if(NOT DEFINED CUDAToolkit_VERSION) + message( FATAL_ERROR "Unable to determine CUDAToolkit_VERSION, CMake will exit." ) + endif() + + if(CUDAToolkit_VERSION VERSION_GREATER "10.1" OR CUDAToolkit_VERSION VERSION_EQUAL "10.1") add_definitions(-DTRITON_ENABLE_CUDA_GRAPH=1) else() - message(WARNING "CUDA ${CUDA_VERSION} does not support CUDA graphs.") + message(WARNING "CUDA ${CUDAToolkit_VERSION} does not support CUDA graphs.") endif() else() message( FATAL_ERROR "TensorRT backend requires TRITON_ENABLE_GPU=1, CMake will exit." )