Search code examples
cmakebuild

Cmake doesn't see epoxy lib


I'm trying to build ORM-SLAM3, however I have linking error:

[ 39%] Linking CXX shared library ../lib/libORB_SLAM3.so
/usr/bin/ld: cannot find -lepoxy::epoxy: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ORB_SLAM3.dir/build.make:605: ../lib/libORB_SLAM3.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:192: CMakeFiles/ORB_SLAM3.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I have epoxy lib installed:

$ sudo apt-get install libepoxy-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libepoxy-dev is already the newest version (1.5.10-1).
0 upgraded, 0 newly installed, 0 to remove and 87 not upgraded.

Also I have warnings like this:

CMake Warning (dev) at CMakeLists.txt:391 (add_executable):
  Policy CMP0028 is not set: Double colon in target name means ALIAS or
  IMPORTED target.  Run "cmake --help-policy CMP0028" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target "stereo_inertial_realsense_D435i_old" links to target "epoxy::epoxy"
  but the target was not found.  Perhaps a find_package() call is missing for
  an IMPORTED target, or an ALIAS target is missing?
This warning is for project developers.  Use -Wno-dev to suppress it.

But CMake can't find epoxy. If I add find_package(epoxy REQUIRED) then my build is failed with error:

CMake Error at CMakeLists.txt:46 (find_package):
  By not providing "Findepoxy.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "epoxy", but
  CMake did not find one.

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

    epoxyConfig.cmake
    epoxy-config.cmake

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

I can't find epoxy-config.cmake file in my system by myself, but as I showed before epoxy is installed.

So how to fix this?


Solution

  • Solution found. To solve this problem it's need to download file from Pangolin repository and put it in project dir, after that in CMakeList.txt add:

    set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/)
    find_package(epoxy REQUIRED)
    include_directories(
    ${epoxy_INCLUDE_DIRS}
    )
    target_link_libraries(${PROJECT_NAME}
    ${epoxy_LIBRARIES}
    )