Cmake error CMake Error at CMakeLists.txt: Can't find Google Log (glog). Please set either ... Solution

  When compiling ceres-solver, an error was reported that glog could not be found. The complete error message is as follows:

CMake Error at CMakeLists.txt:467 (message):
  Can't find Google Log (glog).  Please set either: glog_DIR (newer CMake
  built versions of glog) or GLOG_INCLUDE_DIR & GLOG_LIBRARY or enable
  MINIGLOG option to use minimal glog implementation.

  Perhaps, when we see that a package cannot be found, our first reaction will be to pip install it. However, it doesn't work. It may be because pip is installed in the virtual environment, and cmake cannot find it. According to the error message, it can be seen that the optional solutions are:

  1. set glog_DIR (newer CMake built versions of glog)
  2. set GLOG_INCLUDE_DIR & GLOG_LIBRARY
  3. enable MINIGLOG option to use minimal glog implementation

  So, I locate glogfound the glog related information on the system through the command, as shown in the figure below: From the
insert image description here
  output of the first four lines, we can see that when we downloaded the source code of clone ceres, we had already cloned the miniglog by the way. Therefore, the third solution will probably be the easiest. We open the CMakeLists.txt file of the project, find the location of the error (I am line 467 here), and then add it in front (that is, set the variable value set(MINIGLOG 1)of MINIGLOG to 1, so that we can take the if branch, and the miniglog will be automatically compiled), as shown in the figure below: Then save and
insert image description here
  exit, and run cmake again, and the problem is successfully solved.

Guess you like

Origin blog.csdn.net/weixin_44120025/article/details/128053713