testing/pcl: fix PCL can not be found on this machine
Hi, community.
I am testing the pcl-dev
package but it seems there is an error in finding the library.
How to reproduce
- I run:
apk add pcl-dev
- 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
Edited by Daniel