Skip to content

CMake package exports: remove stale absolute OSG paths from imported osgEarth targets - #2991

Draft
gwaldron with Copilot wants to merge 2 commits into
masterfrom
copilot/cmake-configuration-build-error
Draft

CMake package exports: remove stale absolute OSG paths from imported osgEarth targets#2991
gwaldron with Copilot wants to merge 2 commits into
masterfrom
copilot/cmake-configuration-build-error

Conversation

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Downstream builds can fail because installed osgearth-targets.cmake may contain machine-specific absolute OpenSceneGraph library paths (from legacy FindOpenSceneGraph resolution). When consumed on another system, those paths are invalid and break linking.

  • Package config import sanitization

    • Added a post-import cleanup step in cmake/osgearth-config.cmake.in to remove absolute path entries in INTERFACE_LINK_LIBRARIES when they point to known OSG/OpenThreads libs (osg, osgDB, osgGA, osgUtil, osgViewer, osgText, osgSim, osgShadow, osgManipulator, OpenThreads).
    • Handles both plain entries and $<LINK_ONLY:...> entries.
    • Preserves non-OSG entries and link keywords (optimized, debug, general).
  • Rebind OSG dependencies at consume time

    • After find_dependency(OpenSceneGraph ...), the config now links osgEarth::osgEarth against ${OPENSCENEGRAPH_LIBRARIES} so consumers use their local OSG resolution instead of stale exported absolute paths.
find_dependency(OpenSceneGraph REQUIRED COMPONENTS osg osgDB osgGA osgUtil osgViewer OpenThreads)

# after importing osgEarth::* targets
_osgearth_remove_legacy_osg_paths(osgEarth::osgEarth)

target_link_libraries(osgEarth::osgEarth INTERFACE ${OPENSCENEGRAPH_LIBRARIES})

Copilot AI linked an issue Jul 27, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix cmake configuration build error due to hard coded osg lib paths CMake package exports: remove stale absolute OSG paths from imported osgEarth targets Jul 27, 2026
Copilot AI requested a review from gwaldron July 27, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmake configuration build error

2 participants