问题表现

Ubuntu16.04,ROS Kinetic Kame下运行catkin_make,发现找不到glog相关cmake文件的问题,如下图:
解决catkin_make找不到“glogConfig.cmake”和“glog-config.cmake”的问题

问题的解决

  1. 首先保证glog已经正确安装(网上有很多教程)
  2. 确认“glog-config.cmake”文件存在,比如在安装地址/usr/local/lib/cmake/glog下存在。
  3. 在“CmakeLists.txt”文件中增加一行对glog路径的指定

set(glog_DIR “/usr/local/lib/cmake/glog/”)

  1. 重新编译,问题解决。

一点讨论

遇到类似下面的问题

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

除了安装ROS下对应名称的package解决之外, 对于其它第三方库,也可以用设定CMAKE_PREFIX_PATH方式解决。用于find_package(), find_program(), find_library(), find_file(), and find_path()。

相关文章: