我是CMake的新手,所以我总是更喜欢使用CMake GUI。
我实际上是在建立点云库(PCL)。但是,它还需要其他一些依赖库,其中之一是FLANN-> Git Link FLANN
到目前为止,我所做的是:
设置CMake源代码的路径-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)
我的问题是:我需要做什么才能使其构建?
错误日志的重要内容是此行:
找不到PkgConfig(丢失:PKG_CONFIG_EXECUTABLE)
与CMake一起使用PkgConfig
并不是真正的跨平台解决方案,因为Windows并未安装pkg-config
实用程序。 (PCL开发人员应该在其CMake中使用find_package()
。也许,这值得在他们的Github上打开错误报告。)在Linux上,这很容易解决。您可以像这样安装pkg-config
:
sudo apt-get install pkg-config
但是,在Windows上,该过程涉及更多。有多种解决方案可在Windows pkg-config
中安装here。我不确定哪个最适合您的情况,因此建议您仔细阅读其中的一些内容。在Windows机器上成功安装pkg-config
实用程序后,清除CMake缓存,然后重新运行。这应该可以消除该错误,并允许您进行构建。