Dependencies used to compile PCL can not be found when compiling something dependent on PCL

Viewed 122

I am trying to build treeseg which requires PCL.

I have successfully compiled PCL from source (yay!) but when I try and build treeseg the compiler can not find any of the packages that PCL has already used e.g. flann

Here is the CMakeLists.txt (I have edited so it finds PCL)

cmake_minimum_required(VERSION 3.10)
project(treeseg)

set(PCL_DIR "/home/users/pwilkes/opt/pcl-pcl-1.10.0/build") # my edit
find_package(PCL 1.10 REQUIRED)
#find_package(Armadillo 9.8 REQUIRED)

include_directories(${PCL_INCLUDE_DIRS} ${ARMADILLO_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/riegl)
link_directories(${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/lib/riegl)

if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
        if(EXISTS "${CMAKE_SOURCE_DIR}/lib/riegl/libscanifc-mt.so")
                add_executable(rxp2pcd ${CMAKE_SOURCE_DIR}/src/rxp2pcd.cpp)
                target_link_libraries(rxp2pcd treeseg scanifc-mt)
        endif()
        else()  
                message(WARNING "rxp executables not building because either RIEGL libs/headers not found, or not a compatible OS.")
endif()

The truncated output from cmake

>     CMake Warning at /home/users/pwilkes/opt/pcl-pcl-1.10.0/build/PCLConfig.cmake:257
> (find_package):
>       By not providing "FindFLANN.cmake" in CMAKE_MODULE_PATH this project has
>       asked CMake to find a package configuration file provided by "FLANN", but
>       CMake did not find one.
>     
>       Could not find a package configuration file provided by "FLANN" with any of
>       the following names:
>     
>         FLANNConfig.cmake
>         flann-config.cmake

My question is, why can PCL find these dependencies and treeseg can not?

Trying to compile on RHEL. flann etc. installed via conda.

1 Answers

So, in my case, it was because I never ran make install. When I did that, it created a pcl-1.9/Modules directory full of files like FindFLANN.cmake. Then I just set PCL_DIR and good to go.

Related