[cmake] Only require Flann for some pcl modules
envgap__PointCloudLibrary__pcl-5654
01 / FAILURE SIGNATURE
As reported upstream
No identifying execution failure has been captured.
Not a benchmark task.
- In a clean container the reported failure did not reproduce, or the known fix did not make the project run.
02 / ENVIRONMENT RECIPE
- Base commit
11bcfa7ac43c9452bd17accfa826f86503f88d0b- Manifest
CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
PointCloudLibrary/pcl #5654 · read the original issue
Would it be possible to only require Flann dependency when compiling `pcl_search`, `pcl_segementation` or `pcl_kdtree`?
**Context**
I'm only building some modules of pcl and I don't want to provide Flann if pcl doesn't need it.
**Describe the solution you'd like**
I did this quick patch in root `CMakeLists.txt`
```cmake
if(BUILD_search OR BUILD_segmentation OR BUILD_kdtree)
find_package(FLANN 1.9.1 REQUIRED)
if(NOT (${FLANN_LIBRARY_TYPE} MATCHES ${PCL_FLANN_REQUIRED_TYPE}) AND NOT (${PCL_FLANN_REQUIRED_TYPE} MATCHES "DONTCARE"))
message(FATAL_ERROR "Flann was selected with ${PCL_FLANN_REQUIRED_TYPE} but found as ${FLANN_LIBRARY_TYPE}")
endif()
endif()
```04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]