openscenegraph / OpenSceneGraph

OpenSceneGraph git repository
http://www.openscenegraph.org
Other
3.25k stars 1.42k forks source link

osg CMake target does not include auto-generated osg/Config #1103

Open mmurrian opened 3 years ago

mmurrian commented 3 years ago

target_include_directories(osg ...) does not include the directory that contains the autogenerated osg/Config.

This prevents building and linking against OpenSceneGraph as part of a larger CMake build (e.g., via add_subdirectory(OpenSceneGraph)) without explicitly installing OSG.

I fixed this by adding $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> in TARGET_INCLUDE_DIRECTORIES in the SETUP_LIBRARY macro of OsgMacroUtils.cmake

robertosfield commented 3 years ago

Please generate a PR if you think you have a useful fix.

mmurrian commented 3 years ago

Will do. I don't understand your build system well enough to know if there's a reason why you wouldn't want it fixed this way... but I'll let you answer that question in a PR.