Make error: No rule to make target 'CUDA_curand_LIBRARY-NOTFOUND' [solved]

When I make a simple example cpp project, cmake passed normally but make gave an error:

No rule to make target 'CUDA_curand_LIBRARY-NOTFOUND', needed by 'example-app'.  Stop.

The cpp source file is like this:

#include <torch/torch.h>
#include <torch/script.h>
#include <iostream>

#include <memory>

int main(int argc, const char* argv[]) {

    torch::Device device(torch::kCUDA);
    std::cout << torch::cuda::is_available() << std::endl;

    torch::Tensor tensor1 = torch::randn({3, 4}, torch::dtype(torch::kFloat32).device(torch::kCUDA, 0).requires_grad(true));

    torch::Tensor tensor = torch::rand({2, 3});
    std::cout << tensor << std::endl;

    std::shared_ptr<torch::jit::script::Module> module = torch::jit::load(argv[1]);

    assert(module != nullptr);
    std::cout << "ok\n";

    // Create a vector of inputs.
    std::vector<torch::jit::IValue> inputs;
    at::Tensor t = torch::ones({1, 3, 256, 257});
    t.to(at::kCUDA);
    inputs.push_back(t);

    module->to(at::kCUDA);



    // Execute the model and turn its output into a tensor.
    auto output = module->forward(inputs).toTensor();

    std::cout << output.slice(/*dim=*/10, /*start=*/0, /*end=*/1) << '\n';
}

Anyone met this or know how to deal with? Many thanks.

Can you try reinstalling CUDA in your system?