Ubuntu14.04 :By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH

Ubuntu14.04 :By not providing “FindEigen3.cmake” in CMAKE_MODULE_PATH

今天下载了hector_slam的源码想要跑一下,结果编译不能通过,并且一直出现如下错误,烦得一逼。研究了一会儿,解决了,方法如下:
这是错误提示:

CMake Warning at hector_compressed_map_transport/CMakeLists.txt:13 (find_package):
  By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Eigen3", but
  CMake did not find one.

  Could not find a package configuration file provided by "Eigen3" with any
  of the following names:

    Eigen3Config.cmake
    eigen3-config.cmake

  Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
  "Eigen3_DIR" to a directory containing one of the above files.  If "Eigen3"
  provides a separate development package or SDK, be sure it has been
  installed.

解决办法:
1、找到一个FindEigen3.cmake文件,直接在电脑里面搜索就行,应该会有的,找不到的请私我。。。
2、复制到自己这个的工程下
3、在工程的CMakeLists.txt里面。添加这句话:

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})*******就是这句,加上就行了。这样cmake就会到你自己工程目录下去找FindEigen3.cmake了。
find_package(Eigen3)
if(NOT EIGEN3_FOUND)
  # Fallback to cmake_modules
  find_package(cmake_modules REQUIRED)
  find_package(Eigen REQUIRED)
  set(EIGEN3_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
  set(EIGEN3_LIBRARIES ${EIGEN_LIBRARIES})  # Not strictly necessary as Eigen is head only
  # Possibly map additional variables to the EIGEN3_ prefix.
else()
  set(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
endif()

你可能感兴趣的:(Ubuntu)