c++ - Cmake 找不到带有错误消息的库路径
问题描述
我尝试将库( PCL )添加到我的 cmake 中,但在尝试构建时会引发以下错误:
C/C++ debug|armeabi-v7a : CMake Error at C:\Users\xxx\ndktest\app\src\main\cpp\CMakeLists.txt:48 (find_package):
By not providing "FindPCL.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "PCL", but
CMake did not find one.
Could not find a package configuration file provided by "PCL" (requested
version 1.3) with any of the following names:
PCLConfig.cmake
pcl-config.cmake
Add the installation prefix of "PCL" to CMAKE_PREFIX_PATH or set "PCL_DIR"
to a directory containing one of the above files. If "PCL" provides a
separate development package or SDK, be sure it has been installed.
这是我的 cmake 的样子(我已经尝试设置 PLC_DIR 并且仍然有相同的错误消息):
cmake_minimum_required(VERSION 3.4.1)
add_library( native-lib SHARED native-lib.cpp )
find_library(log-lib log )
target_link_libraries(native-lib ${log-lib} )
set(PCL_DIR "C:\\Program Files\\PCL 1.6.0\\cmake\\PCLConfig.cmake")
find_package(PCL 1.3 REQUIRED COMPONENTS common io)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(pcd_write_test pcd_write.cpp)
target_link_libraries(pcd_write_test ${PCL_LIBRARIES})
我正在运行windows 10
,并试图包含PCL
到一个Android
项目中
有什么建议为什么它找不到 pcl 库?
编辑:我曾经vcpkg
安装库PCL
,我注意到我指向错误的 PCL 库。现在我指向安装的 PCL 库vcpkg
,我的 CMAKE 现在看起来像这样:
cmake_minimum_required(VERSION 3.4.1)
add_library( native-lib SHARED native-lib.cpp )
find_library(log-lib log )
target_link_libraries(native-lib ${log-lib} )
set(PCL_DIR "C:\\Users\\xxx\\Desktop\\pclndk\\vcpkg\\packages\\pcl_x86-windows\\share\\pcl")
find_package(PCL 1.3 REQUIRED COMPONENTS)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(pcd_write_test pcd_write.cpp)
target_link_libraries(pcd_write_test ${PCL_LIBRARIES})
当我运行它时,错误消息会发生变化(猜测它找到了 PCL,但无法找到 pcl 所需的库(Eigen)):
C:\Users\xxx\ndktest\app\src\main\cpp\CMakeLists.txt : C/C++ debug|armeabi-v7a : CMake Error at C:/Users/xxx/Desktop/pclndk/vcpkg/packages/pcl_x86-windows/share/pcl/PCLConfig.cmake:56 (message):
common is required but eigen was not found
Call Stack (most recent call first):
C:/Users/xxx/Desktop/pclndk/vcpkg/packages/pcl_x86-windows/share/pcl/PCLConfig.cmake:356 (pcl_report_not_found)
C:/Users/xxx/Desktop/pclndk/vcpkg/packages/pcl_x86-windows/share/pcl/PCLConfig.cmake:524 (find_external_library)
CMakeLists.txt:10 (find_package)
我试过添加set(EIGEN_DIR "C:\\Users\\xxx\\Desktop\\pclndk\\vcpkg\\installed\\x86-windows\\share\\eigen3")
or set(EIGEN_DIR "C:\\Users\\xxx\\Desktop\\pclndk\\vcpkg\\installed\\x86-windows\\share\\eigen3")
,但它仍然会显示相同的错误消息common is required but eigen was not found
。有任何想法吗?
EDIT2:将 PCL_DIR 设置为set(PCL_DIR "C:\\Users\\xxx\\Desktop\\pclndk\\vcpkg\\installed\\x86-windows\\share\\pcl")
也具有相同的结果
解决方案
推荐阅读
- android-studio - 如何删除我在 Android Studio 中意外创建的新模块?Git 无法恢复它的状态
- reactjs - 在 Reactjs 中通过 axios 取消我的 POST 请求
- python - 保存 .wav 文件时出现随机系统错误
- reactjs - Table - Ant Design - 在 Virtual table ant 设计中实现过滤器
- c++ - RC6 实施给出了不希望的结果
- java - Java按传递量计算组
- wordpress - 将 R markdown html 输出作为博客文章发布
- php - 我如何告诉 process.php 将值保存到下一个 POST 的 `name=newurl` 值通过表单传递.. FORM POST UPDATE IFRAME URL SRC
- android - 如何解决 espresso 测试在模拟器中冻结?
- python-3.x - 在嵌入中附加文件 (Discord.py)