PointCloudLibrary / PointCloudLibrary/pcl
[CMake] question about transitives external dependencies
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 4.7k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 6
Description
Your Environment
- Operating System and version: Linux Mint 19.3
- Compiler: g++-8
- PCL Version: Latest release 1.10.0 and dev branch
Context
Hello,
I've got a issue/question about how PCL handles external dependencies. I know that you recently change some piece of CMake code but in my opinion there is still a lack of "export" of external libraries (FLANN, VTK, ...) when using PCL COMPONENTS .
Expected Behavior
When I use PCL in a project I would like to do something like:
find_package(PCL 1.10 REQUIRED COMPONENTS common filters features registration search kdtree io)
#Other cmake stuff
...
target_link_libraries(myProject
PUBLIC
pcl_common
pcl_filters
pcl_features
pcl_registration
pcl_search
pcl_kdtree
pcl_io
)
Current Behavior
But currently if I do what I explain in Expected Behavior there are plenty of external libraries that are missing.
We don't want to explicitly link myProject against FLANN, VTK or whatever since they are only needed by PCL.
So I take a look in the PCLConfig.cmake.in file and it seems like there is all the needed information when parsing the PCL components here in the ${PCL_${COMPONENT}_LIBRARIES} , but this variable is reset later in the script but never used.
Possible Solution
What I suggest is to add ${PCL_${COMPONENT}_LIBRARIES} in the INTERFACE_LINK_LIBRARIES. That's what we have done here, this way PCL can be find using CMake target and external libraries such as FLANN seems to be transitive and hidden to final user.
What do you think ? Did I miss a point ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with PCLConfig.cmake.in, especially the component parsing around line 332 and the later reset around line 659. Review how the component library variables feed generated CMake targets, then verify that a project linking the listed PCL components receives external dependencies such as FLANN and VTK transitively without explicitly linking them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100