1
votes

I just got the pcl installed and would like to run the examples in the folder /pcl-pcl-1.7.1/examples. The different examples each have CMakeLists.txt in them, so I thought I just do a cmake . in the terminal followed by make to compile it. After doing that in the terminal I got

CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

So I looked into the cmake file and the weird thing is that these cmake files don' t have the normal cmake layout; which starts with cmake_minimum_required(VERSION 2.8 FATAL_ERROR) and then some other stuff. The CMakeLists.txt file I looked into looked like:

PCL_ADD_EXAMPLE(pcl_example_fast_point_feature_histograms FILES example_fast_point_feature_histograms.cpp
                LINK_WITH pcl_common pcl_kdtree pcl_search pcl_features pcl_io)

PCL_ADD_EXAMPLE(pcl_example_normal_estimation FILES example_normal_estimation.cpp
                LINK_WITH pcl_common pcl_kdtree pcl_search pcl_features pcl_io)

PCL_ADD_EXAMPLE(pcl_example_point_feature_histograms FILES example_point_feature_histograms.cpp
                LINK_WITH pcl_common pcl_kdtree pcl_search pcl_features pcl_io)

PCL_ADD_EXAMPLE(pcl_example_principal_curvatures_estimation FILES example_principal_curvatures_estimation.cpp
                LINK_WITH pcl_common pcl_kdtree pcl_search pcl_features pcl_io)

PCL_ADD_EXAMPLE(pcl_example_shape_contexts FILES example_shape_contexts.cpp
LINK_WITH pcl_common pcl_kdtree pcl_search pcl_features pcl_io)

PCL_ADD_EXAMPLE(pcl_example_spin_images FILES example_spin_images.cpp
                LINK_WITH pcl_common pcl_kdtree pcl_search pcl_features pcl_io)

PCL_ADD_EXAMPLE(pcl_example_rift_estimation FILES example_rift_estimation.cpp
                LINK_WITH pcl_common pcl_kdtree pcl_search pcl_features pcl_io)

PCL_ADD_EXAMPLE(pcl_example_difference_of_normals FILES example_difference_of_normals.cpp
                LINK_WITH pcl_common pcl_kdtree pcl_search pcl_features pcl_io pcl_segmentation pcl_sample_consensus)

I don' t know a whole lot about cmake but I do know it starts with defining stuff. So my question is how do I now compile these pcl examples? Or is there something different about the cmake file?

2
My guess - make pcl_example_difference_of_normals.arrowd

2 Answers

0
votes

CMake allows the build to be split up into several distinct CMakeLists.txt file, which do not necessarily have to work on their own.

In your case, the project probably uses add_subdirectory from the CMakeLists.txt in pcl-pcl-1.7.1 to include the one in examples. The CMakeLists.txt in examples is incomplete, it cannot be run on its own but only when being included as part of the top-level CMake file.

You have two options now:

  • Use a modified top-level CMakeLists.txt to include the one from examples. The easiest way to achieve this is probably to start with the top-level file that ships with pcl and throw out everything that you don't need. Depending on the amount of CMake-voodoo present in that file, you might have to fiddle quite a lot to get it to work.
  • As suggested by @arrowdodger in the comments, just run the full CMake configure on the top-level directory and then selectively compile only the targets that you are interested in. If you are using the Makefile generator, you can just give the names of the requested targets on the command line (maybe write a shell script so you don't have to memorize them all). Most IDEs should also allow to only build a subset of the targets in a project.
0
votes

There are two ways in which you may compile examples.

1) change CMakeLists.txt, un-comment line

### ---[ Set up for examples

include("${PCL_SOURCE_DIR}/cmake/pcl_examples.cmake")

2) if you've already built pcl once, just go to CMakeCache.txt file in your build directory and do below change.

BUILD_examples:BOOL=ON

then just do

make