Skip to content

Commit

Permalink
cmake: Let CUDA_RUNTIME_LIBRARY be overridden
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckatkins committed Oct 14, 2023
1 parent 8efadc3 commit 79952c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ if(USE_CUDA)
set(_compute_cuda_archs TRUE)
endif ()

if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.17 AND
NOT DEFINED CMAKE_CUDA_RUNTIME_LIBRARY)
set(CMAKE_CUDA_RUNTIME_LIBRARY Static)
endif ()

enable_language(CUDA)
if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS 11.0)
message(FATAL_ERROR "CUDA version must be at least 11.0!")
Expand Down
3 changes: 1 addition & 2 deletions cmake/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ function(xgboost_set_cuda_flags target)

set_target_properties(${target} PROPERTIES
CUDA_STANDARD 17
CUDA_STANDARD_REQUIRED ON
CUDA_RUNTIME_LIBRARY Static)
CUDA_STANDARD_REQUIRED ON)

if (CMAKE_INTERPROCEDURAL_OPTIMIZATION AND DEFINED CMAKE_CUDA_DEVICE_LINK_OPTIONS_IPO)
set_target_properties(${target} PROPERTIES
Expand Down

0 comments on commit 79952c6

Please sign in to comment.