Could not find a package configuration file provided by "pcl" (requested
version 1.8) with any of the following names:
pclConfig.cmake
pcl-config.cmake
在 find_package(PCL 1.8 REQUIRED )之前添加set(PCL_DIR /usr/share/pcl-1.8/PCLConfig.cmake),需要注意的地方pclConfig.cmake 对应find_package里面的pcl,而PCLConfig.cmake对应于find_package里面的PCL。
pcl安装目录任意,比如/home/gary/PCL/install_dir
那么通过/home/gary/PCL/install_dir/share/pcl-1.11/可以找到安装目录的详细信息
在使用pcl的时候,就可以如下:
cmake_minimum_required(VERSION 3.10) project(icp) #set(CMAKE_CXX_STANDARD 14) add_compile_options(-std=c++14) set(PCL_DIR /home/gary/PCL/install_dir/share/pcl-1.11/) find_package(PCL REQUIRED) include_directories(${PCL_INCLUDE_DIRS}) link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS}) add_executable(icp main.cpp) target_link_libraries (icp ${PCL_LIBRARIES})
根这里的意思差不多https://zhuanlan.zhihu.com/p/338725301