From 151b7444f77fe76092d430644c882c8950595e9b Mon Sep 17 00:00:00 2001 From: Mark Glines Date: Wed, 4 Nov 2020 11:17:10 -0500 Subject: [PATCH] Use CUDA_LIBRARIES instead of hardcoding the path to libcudart Hardcoded paths don't work when using Debian's packaged version of cuda, as the library paths don't match. CMake's find_package(CUDA) sets CUDA_LIBRARIES to the path of libcudart, so just use that instead. --- CMakeLists.txt | 6 +----- src/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c63757bc8..1a7b63e60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,11 +67,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set(OPTIMIZE "-O3" CACHE STRING "Optimization level") -if(CUDA) - set(C_CXX_FLAGS "-lcudart -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Woverloaded-virtual -pedantic-errors -Wno-deprecated") -else() - set(C_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Woverloaded-virtual -pedantic-errors -Wno-deprecated") -endif(CUDA) +set(C_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Woverloaded-virtual -pedantic-errors -Wno-deprecated") if(OPENMP) set(C_CXX_FLAGS "-fopenmp ${C_CXX_FLAGS}") endif(OPENMP) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f68d4e4c7..7beaeb9c7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,7 +22,7 @@ include_directories(${TACO_SRC_DIR}) add_library(taco ${TACO_LIBRARY_TYPE} ${TACO_HEADERS} ${TACO_SOURCES}) if (CUDA) include_directories(${CUDA_INCLUDE_DIRS}) - target_link_libraries(taco INTERFACE ${CUDA_TOOLKIT_ROOT_DIR}/lib64/libcudart.so) + target_link_libraries(taco PUBLIC ${CUDA_LIBRARIES}) endif (CUDA) install(TARGETS taco DESTINATION lib)