UnknownFreeOccupied / ufomap

UFOMap: An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
https://unknownfreeoccupied.github.io/
BSD 2-Clause "Simplified" License
255 stars 46 forks source link

CMakeLists.txt for a simple project #2

Closed pauljurczak closed 3 years ago

pauljurczak commented 3 years ago

I've built and installed ufomap from source on Ubuntu 20.04 with gcc-9.3. I'm trying to build a simple project. Here is my CMakeLists.txt file:

cmake_minimum_required(VERSION 3.16)
project(hl VERSION 0.1.0)

find_package(ufomap REQUIRED)

add_executable(hl main.cpp)

target_link_libraries(hl ufomap)

It doesn't link with this error:

[build] /usr/bin/ld: cannot find -lufomap

I had to use explicit path instead:

target_link_libraries(hl /usr/local/lib/libMap.so)

What is the correct target_link_libraries usage without an explicit path?

danielduberg commented 3 years ago

HI @pauljurczak,

In the Wiki, there are instructions for how to use UFOMap with ROS. You can find the answer to your specific question in this ROS Tutorials page.

Basically, you have to change the target_link_libraries line to target_link_libraries(hl UFO::Map).

I hope it helps!

pauljurczak commented 3 years ago

Thank you, it works. I'm trying to evaluate UFOMap without ROS, that's why I skipped that part of documentation.

danielduberg commented 3 years ago

Thank you for letting me know, @pauljurczak. I must have imagined that you wrote "ROS", sorry about that. I have added a new entry in the Wiki regarding how to use it in CMake projects. Thank you again!