我使用VCPKG(MS Visual Studio 2017)在Windows上构建了PCL。我正在尝试使用带有以下CMakelists.txt的cmake 3.12和PCL来构建CPP应用程序。
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(compute)
find_package(PCL 1.5 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (compute compute.cpp)
target_link_libraries (compute ${PCL_LIBRARIES})
我还设置了以下环境变量。
set PCL_INCLUDE_DIRS="C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\include\pcl"
SET PCL_LIBRARY_DIRS="C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\lib"
set PCL_LIBRARIES="pcl_common_release.lib;pcl_features_release.lib;pcl_filters_release.lib;pcl_io_ply_release.lib;pcl_io_release.lib"
最初我收到一条错误消息,指出它找不到文件FindPCL.cmake,最终找不到PCLConfig.cmake或PCL-Config.cmake。我设置了环境变量
set PCL_DIR=C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\share\pcl
安装PCLConfig.cmake的位置。它能够检测到文件。然而, 无法检测到PCL(pcl_report_not_found),并显示以下错误。
c:\PCL-Program>cmake .
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.16.27023.1
-- The CXX compiler identification is MSVC 19.16.27023.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Eigen (missing: EIGEN_INCLUDE_DIR)
CMake Error at C:/vcpkg-pcl/vcpkg-master/installed/x64-windows/share/pcl/PCLConfig.cmake:56 (message):
common is required but eigen was not found
Call Stack (most recent call first):
C:/vcpkg-pcl/vcpkg-master/installed/x64-windows/share/pcl/PCLConfig.cmake:356 (pcl_report_not_found)
C:/vcpkg-pcl/vcpkg-master/installed/x64-windows/share/pcl/PCLConfig.cmake:526 (find_external_library)
CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/PCL-Program/CMakeFiles/CMakeOutput.log".
c:\PCL-Program>set EIGEN_INCLUDE_DIR
EIGEN_INCLUDE_DIR=C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\include\Eigen
即使为EIGEN_INCLUDE_DIR设置了环境变量,我仍然遇到相同的错误。请让我知道我是否遵循正确的方法。
谢谢!