CUDA与cmake。找不到配置文件

时间:2015-05-20 07:19:10

标签: c++ cuda cmake ros catkin

我正在尝试让CUDA使用基本上是cmake的catkin(ros)。我还没有.cu文件。作为第一步,我想在CUDA

中添加find_package
find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  image_transport
  roscpp
  message_generation
  CUDA
)

在此之后,cmake系统发出以下错误:

CMake Error at /opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake:75 (find_package):
  Could not find a configuration file for package CUDA.

  Set CUDA_DIR to the directory containing a CMake configuration file for
  CUDA.  The file will have one of the following names:

    CUDAConfig.cmake
    cuda-config.cmake

我可以确认我系统上的CUDA运行正常。我可以成功运行cuda示例:bandwidthTest和deviceQuery。我在/usr/local/cuda-5.5/中有cuda-5.5。

[eeuser@roadrunner bin]$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2013 NVIDIA Corporation
Built on Wed_Jul_17_18:36:13_PDT_2013
Cuda compilation tools, release 5.5, V5.5.0

我还可以确认使用cmake我安装了FindCUDA。

[eeuser@roadrunner bin]$ locate FindCUDA
/usr/share/cmake-2.8/Modules/FindCUDA
/usr/share/cmake-2.8/Modules/FindCUDA.cmake
/usr/share/cmake-2.8/Modules/FindCUDA/make2cmake.cmake
/usr/share/cmake-2.8/Modules/FindCUDA/parse_cubin.cmake
/usr/share/cmake-2.8/Modules/FindCUDA/run_nvcc.cmake

1 个答案:

答案 0 :(得分:2)

这是错误的用法

find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  image_transport
  roscpp
  message_generation
  CUDA
)

而是将其用作 -

FIND_PACKAGE(CUDA REQUIRED)
find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  image_transport
  roscpp
  message_generation
)