Locations PCLConfig.cmake and pcl-config.cmake files for PCL library

batuman picture batuman · May 25, 2016 · Viewed 11k times · Source

I installed PCL using the following commands.

sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
sudo apt-get update
sudo apt-get install libpcl-all

When I compiled my PCL program with the following lines in CMakeLists.txt

find_package(PCL 1.3 REQUIRED COMPONENTS)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

I have errors as

CMake Error at CMakeLists.txt:17 (find_package):
   By not providing "FindPCL.cmake" in CMAKE_MODULE_PATH this project has
   asked CMake to find a package configuration file provided by "PCL", but
   CMake did not find one.

   Could not find a package configuration file provided by "PCL" (requested
   version 1.3) with any of the following names:

     PCLConfig.cmake
     pcl-config.cmake

   Add the installation prefix of "PCL" to CMAKE_PREFIX_PATH or set "PCL_DIR"
   to a directory containing one of the above files.  If "PCL" provides a
   separate development package or SDK, be sure it has been installed.

I can't locate PCLConfig.cmake and pcl-config.cmake in my system.

I did like

locate PCLConfig.cmake

/home/ttt/.local/share/Trash/files/PCLConfig.cmake /home/ttt/.local/share/Trash/files/DemoApplications-master/Calculus/tv_auto_on_off/voxel-sdk/libvoxelpcl/VoxelPCLConfig.cmake.in /home/ttt/.local/share/Trash/files/config/VoxelPCLConfig.cmake.in /home/ttt/.local/share/Trash/files/voxelsdk.2/config/VoxelPCLConfig.cmake.in /home/ttt/.local/share/Trash/info/PCLConfig.cmake.trashinfo /home/ttt/Softwares/voxelsdk/config/VoxelPCLConfig.cmake.in /usr/lib/cmake/VoxelPCL/VoxelPCLConfig.cmake

Does it make sense?

I tried like

set(PCL_DIR "/home/ttt/.local/share/Trash/files/PCLConfig.cmake")
find_package(PCL 1.3 REQUIRED COMPONENTS)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

But still have the same error. How to locate PCLConfig.cmake in my system? Thanks

Answer

Vtik picture Vtik · May 25, 2016

you should specify the PCL dir for the CMake to find it.

In a terminal run :

$ locate PCLConfig.cmake

Then, add the found folder (without the filename) to your CMakeLists like the following :

set(PCL_DIR "/found/folder/")
#change X.x to whatever version yo installed

Sidenote : /usr/share/pcl-x.x is the usual path to your pcl folder.