我已按照this页面上的说明在我的Windows 10计算机上安装PCL 1.8.1。安装过程中没有发生错误,安装程序成功退出。我的CMakeLists.txt
看起来像这样:
cmake_minimum_required(VERSION 3.8)
project(MyProject)
set(CMAKE_CXX_STANDARD 11)
find_package(PCL 1.8 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
set(SOURCE_FILES source/main.cpp)
add_executable(MyProject ${SOURCE_FILES})
target_link_libraries(MyProject ${PCL_LIBRARIES})
我收到以下错误:
CMake Error at /cygdrive/c/Program Files/PCL 1.8.1/cmake/PCLConfig.cmake:44 (message):
PCL can not be found on this machine
Call Stack (most recent call first):
/cygdrive/c/Program Files/PCL 1.8.1/cmake/PCLConfig.cmake:768 (pcl_report_not_found)
CMakeLists.txt:6 (find_package)
我使用Jetbrains CLion进行开发,使用CygWin进行GCC,CMake和GDB。当我在第744-769行查看PCLConfig.cmake
文件时,我发现了一些奇怪的东西:
# check whether PCLConfig.cmake is found into a PCL installation or in a build tree
if(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
# Found a PCL installation
# pcl_message("Found a PCL installation")
set(PCL_INCLUDE_DIRS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}")
set(PCL_LIBRARY_DIRS "${PCL_ROOT}/lib")
if(EXISTS "${PCL_ROOT}/3rdParty")
set(PCL_ALL_IN_ONE_INSTALLER ON)
endif(EXISTS "${PCL_ROOT}/3rdParty")
elseif(EXISTS "${PCL_ROOT}/include/pcl/pcl_config.h")
# Found a non-standard (likely ANDROID) PCL installation
# pcl_message("Found a PCL installation")
...
elseif(EXISTS "${PCL_DIR}/include/pcl/pcl_config.h")
# Found PCLConfig.cmake in a build tree of PCL
# pcl_message("PCL found into a build tree.")
...
else(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
pcl_report_not_found("PCL can not be found on this machine")
endif(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
第一个if条件if(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
为真。我检查了一下。在目录C:/Program Files/PCL 1.8.1//include/pcl-1.8/pcl/
中存在一个名为pcl_config.h
的文件,但由于某种原因,最后一个条件else(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
完全相同,因此也是如此。这就是错误的来源。我不知道,我现在应该做些什么。我应该更改CMake文件,以便只有第一个条件成立吗?请帮帮我。
最好的问候,YpsilonZett