Skip to content

Commit

Permalink
fix cuda build for cmake >= 3.17.0 (microsoft#3362)
Browse files Browse the repository at this point in the history
  • Loading branch information
jywu-msft authored Mar 30, 2020
1 parent 33b5010 commit 355f39d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,12 @@ if (onnxruntime_USE_CUDA)
if ( CMAKE_CUDA_FLAGS )
list(REMOVE_ITEM CMAKE_CUDA_FLAGS "-cudart static")
endif()
string(APPEND CMAKE_CUDA_FLAGS "-cudart shared")
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
# cmake 3.17.0 introduces CMAKE_CUDA_RUNTIME which must be used instead of explicit -cudart shared flag
set(CMAKE_CUDA_RUNTIME_LIBRARY Shared)
else()
string(APPEND CMAKE_CUDA_FLAGS "-cudart shared")
endif()
enable_language(CUDA)
set(CMAKE_CUDA_STANDARD 11)
file(TO_CMAKE_PATH ${onnxruntime_CUDNN_HOME} onnxruntime_CUDNN_HOME)
Expand Down

0 comments on commit 355f39d

Please sign in to comment.