PointCloudLibrary / PointCloudLibrary/pcl

[cmake] Is it possible to use FetchContent to bring in PCL?

Open
#5,081 10 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: bug status: triage
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

Describe the bug

I am trying to bring PCL dependency with CMakes FetchContent Functionality.

Context

FetchContent will download PCL repo at config time and MakeAvailable populates the source folder of pcl.
Then PCL will be built along the original project.

--- CMakeLists.txt ---
cmake_minimum_required(VERSION 3.0.2)
project(fetch_content_example)

include(FetchContent)

FetchContent_Declare(
  PCL
  GIT_REPOSITORY https://github.com/PointCloudLibrary/pcl.git
  GIT_TAG        pcl-1.12.0# release-1.12.0
)
FetchContent_MakeAvailable(PCL)

add_library(${PROJECT_NAME}_parser
  src/parser.cpp
)
target_link_libraries(${PROJECT_NAME}_parser pcl_common)
--- src/parser.hpp ---
#ifndef PARSER_H
#define PARSER_H
# pragma once
 
#include <pcl/point_types.h>
  # code
  
--- src/parser.cpp ---
   # Implementation

After invoking cmake and then start to build the project, PCL builds succesfully but when building src/parser.cpp an error occurs of fatal error: pcl/point_types.h: No such file or directory #include <pcl/point_types.h> .

I tried multiple include structures such as
#include <pcl/pcl/point_types.h>
#include <pcl-1.12.0/pcl/point_types.h>

with the same error.

Expected behavior
I don't know if it should be supported (other than building from source and installing it) but I would expect to be able to find the header files.

Current Behavior

No build produced
To Reproduce
Files containing the code above.
mkdir && cd build
cmake ..
make -j8

Your Environment (please complete the following information):

  • OS: [e.g. Ubuntu 18.04]
  • Compiler: [:eg GCC 7.5]
  • PCL Version [e.g. tag pcl-1.12.0]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided CMakeLists.txt and the parser.hpp/parser.cpp example, then reproduce the failure with cmake .. and make -j8. Check how the FetchContent-built PCL exposes headers to the example target and document whether the expected include path is supported or what project change is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.