Skip to content

testing/pcl: fix PCL can not be found on this machine

Daniel requested to merge danielTobon43/aports:pcl-dev into master

Hi, community.

I am testing the pcl-dev package but it seems there is an error in finding the library.

Screenshot_from_2022-07-21_09-29-00

How to reproduce

  1. I run:

apk add pcl-dev

  1. run a simple hello-world
# CMakeLists.txt
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(hello)
find_package(PCL 1.8 REQUIRED)
add_executable(${PROJECT_NAME} main.cpp)
target_include_directories(${PROJECT_NAME} PRIVATE ${PCL_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES})
# main.cpp
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

int main (int argc, char** argv){
  pcl::PointCloud<pcl::PointXYZ> cloud;

  // Fill in the cloud data
  cloud.width    = 5;
  cloud.height   = 1;
  cloud.is_dense = false;
  cloud.points.resize (cloud.width * cloud.height);

  for (auto& point: cloud)  {
    point.x = 1024 * rand () / (RAND_MAX + 1.0f);
    point.y = 1024 * rand () / (RAND_MAX + 1.0f);
    point.z = 1024 * rand () / (RAND_MAX + 1.0f);
  }

  for (const auto& point: cloud)
    std::cout << "    " << point.x << " " << point.y << " " << point.z << std::endl;

  return 0;
}

I think the error is because PCL has a default relative path to the package config.

I checked the PCLConfig.cmake

Screenshot_from_2022-07-21_09-45-46

Edited by Daniel

Merge request reports