# Revision history [back]

Hello buckbuck,

I suggest you do the following... Change the CMakeLists.txt slightly so that it looks as follows:

find_package(G2O REQUIRED)
message("G2O_DIR " ${G2O_DIR})  Run catkin_make and find the added message. I suspect you did not get the wanted result and that your G2O_DIR is not pointing where you want. If that is the case, you can fix it by adding one line to your CMakeLists.txt. set(G2O_DIR$ENV{G2O_DIR})
find_package(G2O REQUIRED)


One caveat, however... You have to make sure that the environment variable exists in the terminal you are working in. Since you've checked it I guess that part is okay.

If you have any further questions, feel free to ask. :)

Hello buckbuck,

I suggest you do the following... Change the CMakeLists.txt slightly so that it looks as follows:

find_package(G2O REQUIRED)
message("G2O_DIR " ${G2O_DIR})  Run catkin_make and find the added message. I suspect you did not get the wanted result and that your G2O_DIR is not pointing where you want. If that is the case, you can fix it by adding one line to your CMakeLists.txt. set(G2O_DIR$ENV{G2O_DIR})
find_package(G2O REQUIRED)


One caveat, however... You have to make sure that the environment variable exists in the terminal you are working in. Since you've checked it I guess that part is okay.

If you have any further questions, feel free to ask. :)

Update based on buckbuck's comment: To be able to understand why include directories are not the ones you expect, you have to know how find_package works. By setting the G2O_DIR you have explicitly said to CMake to try to find G2OConfig.cmake in the provided path. So, the find_package tries to find <package>Config.cmake file and inside it, <package>_INCLUDE_DIRS and <package>_LIBRARIES etc. are defined.

Therefore, I suspect that the path you have provided does not have G2OConfig.cmake file. Now, every package has a different build rules and not every package has the same configuration, but, if you have installed G2O to /home/rover1/rgbd_slam_dep/g2ofork, check in your build folder for Config.cmake file and if you have one, export the following:

export G2O_DIR=/home/rover1/rgbd_slam_dep/g2ofork/build