c++ - CMake - FLANN 库不构建(用于 PCL 库)
问题描述
我是 CMake 的新手,所以我总是喜欢使用 CMake GUI。
我实际上是在设置点云库(PCL)。但是,它需要一些其他依赖库,其中之一是 FLANN -> Git Link FLANN
到目前为止我所做的是:
- 从链接下载源:Git Link FLANN
- 创建了一个构建目录
设置 CMake SOURCE 代码路径 -
C:/PCL/flann-master
设置 CMake 构建二进制文件路径 -
C:/PCL/flann-master/build
- 检查分组和高级选项
- 配置
它给出了以下错误:
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)
我的问题是:我需要做什么才能构建它?
解决方案
我以这种方式在 Windows(使用 Visual Studio 2015)上构建了 FLANN(x64):
在主要CMakeLists.txt
我已经像这样注释掉 lz4 部分:
#if( NOT WIN32)
# find_package(PkgConfig REQUIRED)
# pkg_search_module(LZ4 REQUIRED liblz4)
#endif()
我已将lz4.h
、lz4hc.h
和复制lz4.c
到目录lz4hc.c
./src/cpp/flann/util
现在我已经生成了 Visual Studio 解决方案,并且在flann
解决方案中,我手动添加了lz4.c
和lz4hc.c
源。(如果您想构建绑定和 FLANN 库的其他部分,请将相同的源添加到他们的解决方案中)。
构建项目,它将正确构建。
推荐阅读
- c - 如何运行 2 个子进程,但在 C 中一个接一个地运行?
- php - Docker:禁止您无权访问此资源
- python-3.x - Keras 模型 AttributeError:“str”对象没有属性“call”
- swift - 当设备方向更改 SWIFT 5 时重绘自定义 UIVIEW
- jquery - jQuery选择具有相同ID的当前元素
- c++ - 性能建议编译器 - 这样的事情存在吗?
- python - 创建嵌套字典的更好方法?
- r - 在 RShiny 中集成传单地图 - 按国家和症状输入选择
- react-native - React Native 表格组件
- google-sheets - 如何根据 Google 表格中的一系列值动态创建字符串