gwaldron / osgearth

3D Maps for OpenSceneGraph / C++14
https://www.pelicanmapping.com/home-1/opensource
Other
1.48k stars 774 forks source link

Dependencies Not Propagates to Consuming Projects #2477

Closed Glostav closed 4 months ago

Glostav commented 5 months ago

When osgEarth is installed with vcpkg and imported with the osgEarthConfig.cmake file, osgEarth lib and headers are imported, but lib files and headers of other dependencies used by the osgEarth are not imported. This results in linker errors when compiling. osgEarthConfig.cmake could be updated to find dependencies of osgEarth.

gwaldron commented 5 months ago

Unless I misunderstand you, this is outside the scope of the CMake packager. When you vcpkg install osgearth it will build and install osgEarth and all of its dependencies. Can you provide more information? Like the linker errors you are seeing?

Glostav commented 5 months ago

Installing and building osgEarth and its dependencies with vcpkg works perfectly. This is only about CMake. After the installation when I added the osgEarth to my cmake project with the line find_package(osgEarth CONFIG), CMake finds and includes osgEarth but not its dependencies, because osgEarthConfig.cmake file only adds osgEarth library and headers. But for example in blosc library's blosc-config.cmake file adds its dependencies. We can see dependencies are added with lines like this: find_dependency(lz4 CONFIG) in the config file. So to use the blosc we only need to add find_package(blosc CONFIG) and all the other dependencies will be added by the blosc-config.cmake file. I fixed the linker errors by adding dependencies to my CMakeLists file but osgEarthConfig.cmake could be updated to find osgEarth dependencies.

gwaldron commented 5 months ago

Which dependencies are giving you linker errors? Is it just OpenSceneGraph?

gwaldron commented 5 months ago

I pushed an update and a test that will automatically bring in osg. Give it a try.