无法使用cmake编译pcl示例 [英] Cannot compile pcl examples with cmake

查看:130
本文介绍了无法使用cmake编译pcl示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了pcl,并希望在/pcl-pcl-1.7.1/examples文件夹中运行示例.每个不同的示例中都有CMakeLists.txt,因此我认为我只是做了一个cmake.在终端中,然后用make进行编译.在终端上完成此操作后,我得到了

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

CMakeLists.txt中的

CMake警告(dev):没有cmake_minimum_required命令存在.一行代码,例如

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)

所以我查看了cmake文件,奇怪的是,这些cmake文件没有正常的cmake布局.它以cmake_minimum_required(VERSION 2.8 FATAL_ERROR)开头,然后是其他一些内容.我查看的CMakeLists.txt文件如下所示:

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)

我对cmake并不了解很多,但我确实知道它始于定义东西.所以我的问题是我现在该如何编译这些pcl示例?还是cmake文件有什么不同之处?

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?

推荐答案

可以使用两种方式来编译示例.

There are two ways in which you may compile examples.

1)更改CMakeLists.txt,取消注释行

1) change CMakeLists.txt, un-comment line

### --- [设置示例

### ---[ Set up for examples

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

2)如果已经构建过pcl,只需转到构建目录中的CMakeCache.txt文件,然后进行以下更改即可.

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 = 打开

然后就做

make

这篇关于无法使用cmake编译pcl示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆