diff --git a/Nwpw/CMakeLists.txt b/Nwpw/CMakeLists.txt index 1b1b5923..3e89a2f3 100644 --- a/Nwpw/CMakeLists.txt +++ b/Nwpw/CMakeLists.txt @@ -85,7 +85,7 @@ if (NWPW_CUDA) find_package(NVHPC REQUIRED COMPONENTS CUDA MATH NVSHMEM NCCL MPI) else() enable_language(CUDA) - find_package(CUDAToolkit REQUIRED) + find_package(CUDAToolkit REQUIRED COMPONENTS cublas cusolver cufft) message("-- Using cublas : " ${CUDA_cublas_LIBRARY}) message("-- Using cusolver: " ${CUDA_cusolver_LIBRARY}) message("-- Using cufft : " ${CUDA_cufft_LIBRARY}) @@ -227,12 +227,12 @@ endif() if(OpenCL_FOUND) target_link_libraries(pwdft band pspw file nwpwlib ${MPI_LIBRARIES} ${OpenCL_LIBRARY}) -elseif(NWPW_CUDA) - target_include_directories(pwdft PUBLIC ${CUDAToolkit_INCLUDE_DIRS}) + elseif(NWPW_CUDA) + target_include_directories(pwdft PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} ${CUDAToolkit_INCLUDE_DIRS}) if(CMAKE_CXX_COMPILER_ID MATCHES "NVHPC") - target_link_libraries(pwdft band pspw file nwpwlib ${MPI_LIBRARIES} NVHPC::CUDART NVHPC::CUBLAS NVHPC::CUSOLVER NVHPC::CUFFT) + target_link_libraries(pwdft PRIVATE band pspw file nwpwlib ${MPI_LIBRARIES} NVHPC::CUDART NVHPC::CUBLAS NVHPC::CUSOLVER NVHPC::CUFFT) else() - target_link_libraries(pwdft band pspw file nwpwlib ${MPI_LIBRARIES} CUDA::cudart CUDA::cublas CUDA::cusolver CUDA::cufft) + target_link_libraries(pwdft PRIVATE band pspw file nwpwlib ${MPI_LIBRARIES} CUDA::cudart CUDA::cublas CUDA::cusolver CUDA::cufft) endif() elseif(NWPW_HIP) target_include_directories(pwdft PUBLIC ${ROCBLAS_INCLUDE_DIRS} ${ROCFFT_INCLUDE_DIRS} ${ROCSOLVER_INCLUDE_DIRS})