stevenlovegrove / Pangolin

Pangolin is a lightweight portable rapid development library for managing OpenGL display / interaction and abstracting video input.
MIT License
2.39k stars 855 forks source link

Able to build examples, but not able to use Pangolin in a CMake project #932

Closed vyi closed 6 months ago

vyi commented 6 months ago

I'm on windows, using visual studio 16 2019 for building ORB_SLAM3 package and using Pangolin 0.9.1 release.

My directory structure is organized as follows:

 ORB_SLAM3/
   |----**CMakeLists.txt**
   |----Thirdparty/
           |-- Pangolin/
                 |
                 |---  CMakeLists.txt
                 |---  build/
                            |
                            | --- PangolinConfig.cmake
                            | --- Debug/ 
                            | --- Release/
                            | --- include/
                            | --- examples/

The relevant lines in CMakeLists.txt has the following

find_package(Pangolin REQUIRED)

include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/include/CameraModels
${EIGEN3_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
)

target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
${EIGEN3_LIBS}
${BOOST_LIBS}
${Pangolin_LIBRARIES}

)

When I run cmake, I get the following error:

CMake Error at Thirdparty/Pangolin/build/PangolinTargets.cmake:47 (set_target_properties):
  The link interface of target "pango_core" contains:

    Threads::Threads

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  Thirdparty/Pangolin/build/PangolinConfig.cmake:6 (include)
  CMakeLists.txt:67 (find_package)

Please suggest what am I doing wrong and what is the correct way of using Pangolin in a CMake project.

christian-rauch commented 6 months ago

If you have issues building ORB SLAM 3 I suggest checking with https://github.com/UZ-SLAMLab/ORB_SLAM3. According to the CI, Pangolin builds on Windows.