使用cmake编译PCL时报如下错误的解决方法
CMake Error at C:/Program Files (x86)/PCL 1.8.0/3rdParty/VTK/lib/cmake/vtk-7.0/Modules/vtkGUISupportQt.cmake:17 (find_package):
By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Qt5Widgets", but CMake did not find one.
Could not find a package configuration file provided by "Qt5Widgets" with
any of the following names:
Qt5WidgetsConfig.cmake
qt5widgets-config.cmake
Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
"Qt5Widgets_DIR" to a directory containing one of the above files. If
"Qt5Widgets" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
C:/Program Files (x86)/PCL 1.8.0/3rdParty/VTK/lib/cmake/vtk-7.0/vtkModuleAPI.cmake:45 (include)
C:/Program Files (x86)/PCL 1.8.0/3rdParty/VTK/lib/cmake/vtk-7.0/vtkModuleAPI.cmake:15 (vtk_module_load)
C:/Program Files (x86)/PCL 1.8.0/3rdParty/VTK/lib/cmake/vtk-7.0/vtkModuleAPI.cmake:132 (_vtk_module_config_recurse)
C:/Program Files (x86)/PCL 1.8.0/3rdParty/VTK/lib/cmake/vtk-7.0/VTKConfig.cmake:88 (vtk_module_config)
C:/Program Files (x86)/PCL 1.8.0/cmake/PCLConfig.cmake:487 (find_package)
C:/Program Files (x86)/PCL 1.8.0/cmake/PCLConfig.cmake:645 (find_VTK)
C:/Program Files (x86)/PCL 1.8.0/cmake/PCLConfig.cmake:832 (find_external_library)
CMakeLists.txt:7 (find_package)
Configuring incomplete, errors occurred!
解决方法1:修改CMakeLists.txt
在find_package前添加一行set(CMAKE_PREFIX_PATH "C:/Qt/Qt5.5.1/5.5/msvc2013")
解决方法2:修改系统变量
在系统变量中新加一项
变量名为CMAKE_PREFIX_PATH
变量值为C:/Qt/Qt5.5.1/5.5/msvc2013
运行结果: