CMake - FLANN 库未构建(用于 PCL 库)

Thi*_*iya 5 c++ cmake visual-studio point-cloud-library flann

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

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

到目前为止我所做的是:

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

    设置 CMake Build 二进制文件路径 - 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)
Run Code Online (Sandbox Code Playgroud)

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

squ*_*les 0

从错误日志中得到的重要信息是这一行:

找不到 PkgConfig(缺少:PKG_CONFIG_EXECUTABLE)

使用PkgConfigCMake 并不是真正的跨平台解决方案,因为 Windows 并未安装该pkg-config实用程序。(PCL 开发人员应该find_package()在他们的 CMake 中使用。也许,这值得在他们的 Github 上打开错误报告。)在 Linux 上,这是一个简单的修复;你可以pkg-config这样安装:

sudo apt-get install pkg-config
Run Code Online (Sandbox Code Playgroud)

然而,在 Windows 上,该过程更加复杂。此处记录了几种pkg-config在 Windows 上安装的解决方案。我不确定哪一个最直接适用于您的情况,因此我建议阅读其中的一些内容。在 Windows 计算机上成功安装该实用程序后,清除 CMake 缓存并重新运行。这应该会消除错误,并允许您的构建继续进行。pkg-config