diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index df158a64d0b..c9d93f83e5c 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -18,6 +18,7 @@ include(../fetch_rapids.cmake) include(rapids-cmake) include(rapids-cpm) include(rapids-cuda) +include(${rapids-cmake-dir}/cuda/set_runtime.cmake) include(rapids-export) include(rapids-find) @@ -780,17 +781,7 @@ if(TARGET conda_env) target_link_libraries(cudf PRIVATE conda_env) endif() -if(CUDA_STATIC_RUNTIME) - # Tell CMake what CUDA language runtime to use - set_target_properties(cudf PROPERTIES CUDA_RUNTIME_LIBRARY Static) - # Make sure to export to consumers what runtime we used - target_link_libraries(cudf PUBLIC CUDA::cudart_static) -else() - # Tell CMake what CUDA language runtime to use - set_target_properties(cudf PROPERTIES CUDA_RUNTIME_LIBRARY Shared) - # Make sure to export to consumers what runtime we used - target_link_libraries(cudf PUBLIC CUDA::cudart) -endif() +rapids_cuda_set_runtime(cudf USE_STATIC ${CUDA_STATIC_RUNTIME}) file( WRITE "${CUDF_BINARY_DIR}/fatbin.ld" @@ -838,6 +829,7 @@ if(CUDF_BUILD_TESTUTIL) PUBLIC cudf PRIVATE $ ) + rapids_cuda_set_runtime(cudftest_default_stream USE_STATIC ${CUDA_STATIC_RUNTIME}) add_library(cudf::cudftest_default_stream ALIAS cudftest_default_stream) @@ -881,6 +873,7 @@ if(CUDF_BUILD_TESTUTIL) cudftestutil PUBLIC "$" "$" ) + rapids_cuda_set_runtime(cudftestutil USE_STATIC ${CUDA_STATIC_RUNTIME}) add_library(cudf::cudftestutil ALIAS cudftestutil) endif() @@ -919,6 +912,7 @@ if(CUDF_BUILD_STREAMS_TEST_UTIL) if(CUDF_BUILD_STACKTRACE_DEBUG) target_link_libraries(${_tgt} PRIVATE cudf_backtrace) endif() + rapids_cuda_set_runtime(${_tgt} USE_STATIC ${CUDA_STATIC_RUNTIME}) add_library(cudf::${_tgt} ALIAS ${_tgt}) if("${_mode}" STREQUAL "testing") diff --git a/cpp/cmake/Modules/JitifyPreprocessKernels.cmake b/cpp/cmake/Modules/JitifyPreprocessKernels.cmake index baabffceeac..8a40be1dc94 100644 --- a/cpp/cmake/Modules/JitifyPreprocessKernels.cmake +++ b/cpp/cmake/Modules/JitifyPreprocessKernels.cmake @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2021-2023, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at @@ -16,7 +16,8 @@ add_executable(jitify_preprocess "${JITIFY_INCLUDE_DIR}/jitify2_preprocess.cpp") target_compile_definitions(jitify_preprocess PRIVATE "_FILE_OFFSET_BITS=64") -target_link_libraries(jitify_preprocess CUDA::cudart ${CMAKE_DL_LIBS}) +rapids_cuda_set_runtime(jitify_preprocess USE_STATIC ${CUDA_STATIC_RUNTIME}) +target_link_libraries(jitify_preprocess PUBLIC ${CMAKE_DL_LIBS}) # Take a list of files to JIT-compile and run them through jitify_preprocess. function(jit_preprocess_files) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index eee736613fe..064d0c49f80 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -58,6 +58,7 @@ function(ConfigureTest CMAKE_TEST_NAME) ${CMAKE_TEST_NAME} PRIVATE cudftestutil GTest::gmock_main GTest::gtest_main $ ) + rapids_cuda_set_runtime(${CMAKE_TEST_NAME} USE_STATIC ${CUDA_STATIC_RUNTIME}) rapids_test_add( NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}