首页 > 解决方案 > CMake - FLANN 库不构建(用于 PCL 库)

问题描述

我是 CMake 的新手,所以我总是喜欢使用 CMake GUI。

我实际上是在设置点云库(PCL)。但是,它需要一些其他依赖库,其中之一是 FLANN -> Git Link FLANN

到目前为止我所做的是:

  1. 从链接下载源:Git Link FLANN
  2. 创建了一个构建目录
  3. 设置 CMake SOURCE 代码路径 -C:/PCL/flann-master

    设置 CMake 构建二进制文件路径 -C:/PCL/flann-master/build

  4. 检查分组高级选项
  5. 配置

在此处输入图像描述

它给出了以下错误:

CMake Warning (dev) at CMakeLists.txt:17 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:21 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.13/Modules/FindPkgConfig.cmake:39 (find_package_handle_standard_args)
  CMakeLists.txt:149 (find_package)

我的问题是:我需要做什么才能构建它?

标签: c++visual-studiocmakepoint-cloud-libraryflann

解决方案


我以这种方式在 Windows(使用 Visual Studio 2015)上构建了 FLANN(x64):

在主要CMakeLists.txt我已经像这样注释掉 lz4 部分:

#if( NOT WIN32)
#  find_package(PkgConfig REQUIRED)
#  pkg_search_module(LZ4 REQUIRED liblz4)
#endif()

我已将lz4.hlz4hc.h和复制lz4.c到目录lz4hc.c./src/cpp/flann/util

现在我已经生成了 Visual Studio 解决方案,并且在flann解决方案中,我手动添加了lz4.clz4hc.c源。(如果您想构建绑定和 FLANN 库的其他部分,请将相同的源添加到他们的解决方案中)。

构建项目,它将正确构建。


推荐阅读