google / s2geometry

Computational geometry and spatial indexing on the sphere
http://s2geometry.io/
Apache License 2.0
2.29k stars 302 forks source link

After installing s2geometry, CMakeLists.txt failed on "find_package(s2geometry REQUIRED)" #331

Closed GoroYeh-HRI closed 10 months ago

GoroYeh-HRI commented 11 months ago

Hello, I followed your instructions for installing s2geometry and I confirmed it is installed under /usr/local/include image image

However, when I'm trying to use s2geometry in my another Cmake project, in CMakeLists.txt I wrote find_package(s2geometry REQUIRED) and run cmake ... The compiler has error about this: image

Also, once I changed the CMakeLists.txt to be:

include_directories(/usr/local/include/s2)

add_executable(myexe ${SOURCES})

target_link_libraries(myexe s2)

cmake .. worked, but when I run make: image Why can't s2geometry find absl?

Any idea on how to resolve this issue? Thanks,

smcallis commented 11 months ago

I'll defer to @jmr since I don't poke at the CMake files much. I'm not sure that we support FindPackage automatically.

jmr commented 11 months ago

What's the goal here? Are you trying to just get something working for yourself, or do you want do distribute a CMakeLists.txt for others to use?

Why can't s2geometry find absl?

The error is from cloud_mapper not finding absl. Did you also make install absl, or also add it to include_directories?

GoroYeh-HRI commented 10 months ago

I actually resolved this by writing the CMakeLists.txt as this: image

Also, I installed everything under /usr/local/include and it's able to find.