1. 程式人生 > >PCL例程使用CMake匯入VS2013失敗

PCL例程使用CMake匯入VS2013失敗

安裝完PCL all_in_one 之後,使用CMake將例程生成為VS2013的工程
配置完成選擇生成後介面如下:
這裡寫圖片描述
有問題的有三行,如圖紅線所示:
1. OPENNI_INCLUDE_DIRS-NOTFOUND
2. OPENNI_LIBRARY-NOTFOUND
3. VTK_DIR-NOTFOUND
其中:1、2不是關鍵配置,只會導致警報。
3是導致生成失敗的主要原因。

詳細報錯資訊如下圖所示:
Could NOT find openni (missing: OPENNI_LIBRARY OPENNI_INCLUDE_DIRS)
* WARNING *

io features related to openni will be disabled
* WARNING * io features related to pcap will be disabled
* WARNING * io features related to png will be disabled
CMake Warning at C:/Program Files/PCL 1.7.2/cmake/PCLConfig.cmake:291 (find_package):
By not providing “FindVTK.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “VTK”, but
CMake did not find one.

Could not find a package configuration file provided by “VTK” with any of
the following names:

VTKConfig.cmake
vtk-config.cmake

Add the installation prefix of “VTK” to CMAKE_PREFIX_PATH or set “VTK_DIR”
to a directory containing one of the above files. If “VTK” provides a
separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
C:/Program Files/PCL 1.7.2/cmake/PCLConfig.cmake:429 (find_VTK)
C:/Program Files/PCL 1.7.2/cmake/PCLConfig.cmake:615 (find_external_library)
CMakeLists.txt:3 (find_package)



CMake Error at C:/Program Files/PCL 1.7.2/cmake/PCLConfig.cmake:44 (message):
visualization is required but vtk was not found
Call Stack (most recent call first):
C:/Program Files/PCL 1.7.2/cmake/PCLConfig.cmake:459 (pcl_report_not_found)
C:/Program Files/PCL 1.7.2/cmake/PCLConfig.cmake:618 (find_external_library)
CMakeLists.txt:3 (find_package)

解決方案:
找到PCLConfig.cmake所在資料夾C:\PCL 1.7.2\cmake,將PCLConfig.cmake第293行

這裡寫圖片描述

檢視所安裝PCL的VTKConfig.make所在的目錄:

這裡寫圖片描述

將PCLConfig.cmake第293行改為相應的目錄:

這裡寫圖片描述

點選生成,成功生成專案,並且只剩下,幾個警告。